diff --git a/application/src/Entity/Node.php b/application/src/Entity/Node.php index d00066f..9ed99e9 100644 --- a/application/src/Entity/Node.php +++ b/application/src/Entity/Node.php @@ -14,6 +14,7 @@ use Doctrine\Common\Collections\Collection; /** * @author kevinfrantz + * @todo rename and refactor this class * @ORM\Table(name="node") * @ORM\Entity() */ @@ -39,7 +40,8 @@ class Node extends AbstractEntity implements NodeInterface /** * Many Nodes have many childs. - * + * @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="Node") * @ORM\JoinTable(name="nodes_childs", * joinColumns={@ORM\JoinColumn(name="node_id", referencedColumnName="id")}, diff --git a/application/src/Entity/Source/AbstractSource.php b/application/src/Entity/Source/AbstractSource.php index e536f6a..364ae1b 100644 --- a/application/src/Entity/Source/AbstractSource.php +++ b/application/src/Entity/Source/AbstractSource.php @@ -17,7 +17,7 @@ use App\Entity\Node; * @ORM\Table(name="source") * @ORM\InheritanceType("JOINED") * @ORM\DiscriminatorColumn(name="discr", type="string") - * @ORM\DiscriminatorMap({"user" = "UserSource","name" = "NameSource"}) + * @ORM\DiscriminatorMap({"user" = "UserSource","name" = "NameSource","collection" = "SourceCollection"}) */ abstract class AbstractSource extends AbstractEntity implements SourceInterface { diff --git a/application/src/Entity/Source/Attribut/SourceMembersAttribut.php b/application/src/Entity/Source/Attribut/SourceMembersAttribut.php new file mode 100644 index 0000000..075cc19 --- /dev/null +++ b/application/src/Entity/Source/Attribut/SourceMembersAttribut.php @@ -0,0 +1,26 @@ +members; + } + + public function setMembers(Collection $members):void{ + $this->members = $members; + } +} + diff --git a/application/src/Entity/Source/Attribut/SourceMembersAttributInterface.php b/application/src/Entity/Source/Attribut/SourceMembersAttributInterface.php new file mode 100644 index 0000000..0bd7ca6 --- /dev/null +++ b/application/src/Entity/Source/Attribut/SourceMembersAttributInterface.php @@ -0,0 +1,29 @@ +members->next(); + } + + public function forAll(Closure $p) + { + return $this->members->forAll($p); + } + + public function remove($key) + { + return $this->members->remove($key); + } + + public function current() + { + return $this->members->current(); + } + + public function partition(Closure $p) + { + return $this->members->partition($p); + } + + public function offsetExists($offset) + { + return $this->offsetExists($offset); + } + + public function slice($offset, $length = null) + { + return $this->slice($offset, $length); + } + + public function get($key) + { + return $this->members->get($key); + } + + public function offsetUnset($offset) + { + return $this->members->offsetUnset($offset); + } + + public function toArray() + { + return $this->members->toArray(); + } + + public function map(Closure $func) + { + return $this->members->map($func); + } + + public function indexOf($element) + { + return $this->members->indexOf($element); + } + + public function key() + { + return $this->members->key(); + } + + public function add($element) + { + return $this->add($element); + } + + public function offsetGet($offset) + { + return $this->members->offsetGet($offset); + } + + public function set($key, $value) + { + return $this->members->set($key, $value); + } + + public function getValues() + { + return $this->members->getValues(); + } + + public function last() + { + return $this->members->last(); + } + + public function containsKey($key) + { + return $this->members->containsKey($key); + } + + public function clear() + { + return $this->members->clear(); + } + + public function isEmpty() + { + return $this->members->isEmpty(); + } + + public function count() + { + return $this->members->count(); + } + + public function getKeys() + { + return $this->members->getKeys(); + } + + public function offsetSet($offset, $value) + { + return $this->members->offsetSet($offset, $value); + } + + public function filter(Closure $p) + { + return $this->members->filter($p); + } + + public function contains($element) + { + return $this->members->contains($element); + } + + public function getIterator() + { + return $this->members->getIterator(); + } + + public function exists(Closure $p) + { + return $this->members->exists($p); + } + + public function removeElement($element) + { + return $this->members->removeElement($element); + } + + public function first() + { + return $this->members->first(); + } +} + diff --git a/application/src/Entity/Source/SourceCollectionInterface.php b/application/src/Entity/Source/SourceCollectionInterface.php new file mode 100644 index 0000000..d4de89a --- /dev/null +++ b/application/src/Entity/Source/SourceCollectionInterface.php @@ -0,0 +1,107 @@ +