diff --git a/application/src/Creator/Modificator/Entity/LawModificator.php b/application/src/Creator/Modificator/Entity/LawModificator.php index afd15c9..868650e 100644 --- a/application/src/Creator/Modificator/Entity/LawModificator.php +++ b/application/src/Creator/Modificator/Entity/LawModificator.php @@ -11,6 +11,8 @@ use App\DBAL\Types\RecieverType; use App\Entity\Meta\RightInterface; use App\Entity\Meta\RecieverGroupInterface; use App\Entity\Meta\RecieverGroup; +use App\Entity\Meta\RecieverInterface; +use App\Entity\Meta\Reciever; /** * @author kevinfrantz @@ -22,7 +24,7 @@ abstract class LawModificator foreach (LayerType::getChoices() as $layerKey => $layerValue) { foreach (RightType::getChoices() as $rightKey => $rightValue) { $right = self::createRight($law, $node, $rightKey, $layerKey); - $right->setRecieverGroup(self::createRecieverGroup($node, RecieverType::NODE)); + //$right->setRecieverGroup(self::createRecieverGroup($node, RecieverType::NODE)); $law->getRights()->add($right); } } @@ -39,9 +41,9 @@ abstract class LawModificator return $right; } - public static function createRecieverGroup(RelationInterface $node, string $reciever): RecieverGroupInterface + public static function createRecieverGroup(RelationInterface $node, string $reciever): RecieverInterface { - $recieverGroup = new RecieverGroup(); + $recieverGroup = new Reciever(); $recieverGroup->setNode($node); $recieverGroup->setReciever($reciever); diff --git a/application/src/Entity/Meta/Reciever.php b/application/src/Entity/Meta/Reciever.php index 365929b..5b5b186 100644 --- a/application/src/Entity/Meta/Reciever.php +++ b/application/src/Entity/Meta/Reciever.php @@ -11,7 +11,7 @@ use App\Entity\Source\SourceInterface; /** * @author kevinfrantz - * @ORM\Table(name="meta_reciever_group") + * @ORM\Table(name="meta_reciever") * @ORM\Entity() */ class Reciever extends AbstractMeta implements RecieverInterface @@ -29,7 +29,7 @@ class Reciever extends AbstractMeta implements RecieverInterface protected $relation; /** - * @ORM\ManyToMany(targetEntity="App\Entity\AbstractSource") + * @ORM\ManyToMany(targetEntity="App\Entity\Source\AbstractSource") * @ORM\JoinTable(name="meta_reciever_members", * joinColumns={@ORM\JoinColumn(name="reciever_id", referencedColumnName="id")}, * inverseJoinColumns={@ORM\JoinColumn(name="source_id", referencedColumnName="id")} diff --git a/application/src/Entity/Meta/Relation.php b/application/src/Entity/Meta/Relation.php index 1d4e626..9df853c 100644 --- a/application/src/Entity/Meta/Relation.php +++ b/application/src/Entity/Meta/Relation.php @@ -34,26 +34,17 @@ final class Relation extends AbstractMeta implements RelationInterface /** * Parents represent the creators of the relation. * - * @ORM\ManyToMany(targetEntity="Relation") - * @ORM\JoinTable(name="meta_relation_parents", - * joinColumns={@ORM\JoinColumn(name="relation_id", referencedColumnName="id")}, - * inverseJoinColumns={@ORM\JoinColumn(name="relation_id", referencedColumnName="id")} - * ) - * + * @ORM\ManyToMany(targetEntity="Relation",mappedBy="childs") * @var Collection|RelationInterface[] */ protected $parents; /** * Childs represent the by the object produced relations. - * - * @todo Replace this by self referencing - * - * @see https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/reference/association-mapping.html * @ORM\ManyToMany(targetEntity="Relation") * @ORM\JoinTable(name="meta_relation_childs", * joinColumns={@ORM\JoinColumn(name="relation_id", referencedColumnName="id")}, - * inverseJoinColumns={@ORM\JoinColumn(name="relation_id", referencedColumnName="id")} + * inverseJoinColumns={@ORM\JoinColumn(name="child_id", referencedColumnName="id")} * ) * * @var Collection|RelationInterface[] diff --git a/application/src/Entity/Meta/Right.php b/application/src/Entity/Meta/Right.php index 1382aa3..df67868 100644 --- a/application/src/Entity/Meta/Right.php +++ b/application/src/Entity/Meta/Right.php @@ -41,7 +41,7 @@ final class Right extends AbstractMeta implements RightInterface protected $layer; /** - * @ORM\OneToOne(targetEntity="RecieverGroup",cascade={"persist", "remove"}) + * @ORM\OneToOne(targetEntity="Reciever",cascade={"persist", "remove"}) * @ORM\JoinColumn(name="reciever_id", referencedColumnName="id") * * @var RecieverInterface diff --git a/application/src/Entity/Source/AbstractSource.php b/application/src/Entity/Source/AbstractSource.php index f4085b1..1dbb55a 100644 --- a/application/src/Entity/Source/AbstractSource.php +++ b/application/src/Entity/Source/AbstractSource.php @@ -42,7 +42,7 @@ abstract class AbstractSource extends AbstractEntity implements SourceInterface * @todo Rename table to use the right schema * * @var Collection|GroupSource[] - * @ORM\ManyToMany(targetEntity="GroupSource") + * @ORM\ManyToMany(targetEntity="GroupSource",mappedBy="members") */ protected $groups; diff --git a/application/src/Entity/Source/GroupSource.php b/application/src/Entity/Source/GroupSource.php index 73a6998..a25369f 100644 --- a/application/src/Entity/Source/GroupSource.php +++ b/application/src/Entity/Source/GroupSource.php @@ -19,7 +19,8 @@ final class GroupSource extends AbstractSource implements MembersAttributInterfa /** * @var Collection - * @ORM\ManyToMany(targetEntity="AbstractSource") + * @ORM\ManyToMany(targetEntity="AbstractSource",inversedBy="groups") + * @ORM\JoinTable(name="source_group_members") */ protected $members;