From ba3a246c0c2da7fdc7c6931933398ebd7006651d Mon Sep 17 00:00:00 2001 From: Kevin Frantz Date: Sun, 25 Nov 2018 22:33:54 +0100 Subject: [PATCH] Implemented new draft for meta relations --- application/src/Entity/Meta/AbstractMeta.php | 15 ++++ application/src/Entity/Meta/MetaInterface.php | 3 +- application/src/Entity/Meta/Relation.php | 78 ------------------- .../Entity/Meta/Relation/AbstractRelation.php | 16 ++++ .../Meta/Relation/Member/MemberRelation.php | 12 +++ .../Member/MemberRelationInterface.php | 11 +++ .../Parent/AbstractParentRelation.php | 28 +++++++ .../Meta/Relation/Parent/CreatorRelation.php | 28 +++++++ .../Parent/CreatorRelationInterface.php | 7 ++ .../Meta/Relation/Parent/HeredityRelation.php | 32 ++++++++ .../Parent/HeredityRelationInterface.php | 7 ++ .../Parent/ParentRelationInterface.php | 11 +++ .../Meta/Relation/RelationInterface.php | 14 ++++ .../src/Entity/Meta/RelationInterface.php | 16 ---- 14 files changed, 183 insertions(+), 95 deletions(-) delete mode 100644 application/src/Entity/Meta/Relation.php create mode 100644 application/src/Entity/Meta/Relation/AbstractRelation.php create mode 100644 application/src/Entity/Meta/Relation/Member/MemberRelation.php create mode 100644 application/src/Entity/Meta/Relation/Member/MemberRelationInterface.php create mode 100644 application/src/Entity/Meta/Relation/Parent/AbstractParentRelation.php create mode 100644 application/src/Entity/Meta/Relation/Parent/CreatorRelation.php create mode 100644 application/src/Entity/Meta/Relation/Parent/CreatorRelationInterface.php create mode 100644 application/src/Entity/Meta/Relation/Parent/HeredityRelation.php create mode 100644 application/src/Entity/Meta/Relation/Parent/HeredityRelationInterface.php create mode 100644 application/src/Entity/Meta/Relation/Parent/ParentRelationInterface.php create mode 100644 application/src/Entity/Meta/Relation/RelationInterface.php delete mode 100644 application/src/Entity/Meta/RelationInterface.php diff --git a/application/src/Entity/Meta/AbstractMeta.php b/application/src/Entity/Meta/AbstractMeta.php index 9958107..d23cce2 100644 --- a/application/src/Entity/Meta/AbstractMeta.php +++ b/application/src/Entity/Meta/AbstractMeta.php @@ -3,12 +3,27 @@ namespace App\Entity\Meta; use App\Entity\AbstractEntity; +use App\Entity\Attribut\SourceAttribut; +use App\Entity\Source\SourceInterface; +use Doctrine\ORM\Mapping as ORM; /** + * @todo Implement source attribut + * * @author kevinfrantz */ abstract class AbstractMeta extends AbstractEntity implements MetaInterface { + use SourceAttribut; + + /** + * @ORM\OneToOne(targetEntity="App\Entity\Source\AbstractSource",cascade={"persist", "remove"}) + * @ORM\JoinColumn(name="source_id", referencedColumnName="id",onDelete="CASCADE") + * + * @var SourceInterface + */ + protected $source; + public function __construct() { parent::__construct(); diff --git a/application/src/Entity/Meta/MetaInterface.php b/application/src/Entity/Meta/MetaInterface.php index 9caf7a5..a747647 100644 --- a/application/src/Entity/Meta/MetaInterface.php +++ b/application/src/Entity/Meta/MetaInterface.php @@ -3,6 +3,7 @@ namespace App\Entity\Meta; use App\Entity\EntityInterface; +use App\Entity\Attribut\SourceAttributInterface; /** * Meta entities contain informations which describe sources. @@ -10,6 +11,6 @@ use App\Entity\EntityInterface; * * @author kevinfrantz */ -interface MetaInterface extends EntityInterface +interface MetaInterface extends EntityInterface, SourceAttributInterface { } diff --git a/application/src/Entity/Meta/Relation.php b/application/src/Entity/Meta/Relation.php deleted file mode 100644 index 9f7be55..0000000 --- a/application/src/Entity/Meta/Relation.php +++ /dev/null @@ -1,78 +0,0 @@ -law = new Law(); - $this->parents = new ArrayCollection(); - $this->childs = new ArrayCollection(); - } -} diff --git a/application/src/Entity/Meta/Relation/AbstractRelation.php b/application/src/Entity/Meta/Relation/AbstractRelation.php new file mode 100644 index 0000000..cfd97fd --- /dev/null +++ b/application/src/Entity/Meta/Relation/AbstractRelation.php @@ -0,0 +1,16 @@ +parents = new ArrayCollection(); + $this->childs = new ArrayCollection(); + } +} diff --git a/application/src/Entity/Meta/Relation/Parent/CreatorRelation.php b/application/src/Entity/Meta/Relation/Parent/CreatorRelation.php new file mode 100644 index 0000000..79c0d10 --- /dev/null +++ b/application/src/Entity/Meta/Relation/Parent/CreatorRelation.php @@ -0,0 +1,28 @@ +