diff --git a/ERDiagramXMLExportBundle/DependencyInjection/GraphMLWriter.php b/ERDiagramXMLExportBundle/DependencyInjection/GraphMLWriter.php index 7ed26a5..fd354d0 100644 --- a/ERDiagramXMLExportBundle/DependencyInjection/GraphMLWriter.php +++ b/ERDiagramXMLExportBundle/DependencyInjection/GraphMLWriter.php @@ -3,6 +3,7 @@ namespace Basilicom\ERDiagramXMLExportBundle\DependencyInjection; +use phpDocumentor\Reflection\Types\Self_; use Spatie\ArrayToXml\ArrayToXml; class GraphMLWriter @@ -16,6 +17,9 @@ class GraphMLWriter private int $actualBoxHeight = 0; private int $actualBoxWidth = 0; + private const CROWS_FOOT_MANY = 'crows_foot_many'; + private const NONE = 'none'; + /** * GraphMLWriter constructor. * @@ -125,7 +129,10 @@ private function createNode(array $entry, bool $isFieldCollection = false, bool - %s + %s %s @@ -201,20 +208,20 @@ private function createAttributes($entry): string private function createEdge($source, $target, $relationType = '', $labelName) { if (strpos(strtolower($relationType), 'manytomany') !== false) { - $sourceArrowType = 'crows_foot_many'; - $targetArrowType = 'crows_foot_many'; + $sourceArrowType = self::CROWS_FOOT_MANY; + $targetArrowType = self::CROWS_FOOT_MANY; } if (strpos(strtolower($relationType), 'onetomany') !== false) { - $sourceArrowType = 'none'; - $targetArrowType = 'crows_foot_many'; + $sourceArrowType = self::NONE; + $targetArrowType = self::CROWS_FOOT_MANY; } if (strpos(strtolower($relationType), 'manytoone') !== false) { - $sourceArrowType = 'crows_foot_many'; - $targetArrowType = 'none'; + $sourceArrowType = self::CROWS_FOOT_MANY; + $targetArrowType = self::NONE; } if ($relationType == '') { - $sourceArrowType = 'none'; - $targetArrowType = 'none'; + $sourceArrowType = self::NONE; + $targetArrowType = self::NONE; } $edgeContent = " @@ -222,14 +229,19 @@ private function createEdge($source, $target, $relationType = '', $labelName) - %s + %s - +