mirror of
				https://github.com/kevinveenbirkenbach/infinito.git
				synced 2025-10-31 17:29:04 +00:00 
			
		
		
		
	Simpliefied SourceSources
This commit is contained in:
		| @@ -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","collection" = "SourceCollection"}) | ||||
|  * @ORM\DiscriminatorMap({"user" = "UserSource","name" = "NameSource","collection" = "SourcesSource"}) | ||||
|  */ | ||||
| abstract class AbstractSource extends AbstractEntity implements SourceInterface | ||||
| { | ||||
|   | ||||
| @@ -1,26 +0,0 @@ | ||||
| <?php | ||||
| namespace App\Entity\Source\Attribut; | ||||
|  | ||||
| use Doctrine\Common\Collections\Collection; | ||||
|  | ||||
| /** | ||||
|  * | ||||
|  * @author kevinfrantz | ||||
|  *         | ||||
|  */ | ||||
| trait SourceMembersAttribut | ||||
| { | ||||
|     /** | ||||
|      * @var Collection | ||||
|      */ | ||||
|     protected $members; | ||||
|      | ||||
|     public function getMembers():Collection{ | ||||
|         return $this->members; | ||||
|     } | ||||
|      | ||||
|     public function setMembers(Collection $members):void{ | ||||
|         $this->members = $members; | ||||
|     } | ||||
| } | ||||
|  | ||||
							
								
								
									
										30
									
								
								application/src/Entity/Source/Attribut/SourcesAttribut.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								application/src/Entity/Source/Attribut/SourcesAttribut.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,30 @@ | ||||
| <?php | ||||
| namespace App\Entity\Source\Attribut; | ||||
|  | ||||
| use Doctrine\Common\Collections\Collection; | ||||
|  | ||||
| /** | ||||
|  * | ||||
|  * @author kevinfrantz | ||||
|  *         | ||||
|  */ | ||||
| trait SourcesAttribut | ||||
| { | ||||
|  | ||||
|     /** | ||||
|      * | ||||
|      * @var Collection | ||||
|      */ | ||||
|     protected $sources; | ||||
|  | ||||
|     public function getSources(): Collection | ||||
|     { | ||||
|         return $this->sources; | ||||
|     } | ||||
|  | ||||
|     public function setSources(Collection $sources): void | ||||
|     { | ||||
|         $this->sources = $sources; | ||||
|     } | ||||
| } | ||||
|  | ||||
| @@ -9,21 +9,17 @@ use Doctrine\Common\Collections\Collection; | ||||
|  * @author kevinfrantz | ||||
|  *         | ||||
|  */ | ||||
| interface SourceMembersAttributInterface | ||||
| interface SourcesAttributInterface | ||||
| { | ||||
| 
 | ||||
|     /** | ||||
|      * Sets the collection source members | ||||
|      * | ||||
|      * @param Collection $members | ||||
|      */ | ||||
|     public function setMembers(Collection $members): void; | ||||
|     public function setSources(Collection $sources): void; | ||||
| 
 | ||||
|     /** | ||||
|      * Returns the collection source members | ||||
|      * | ||||
|      * @return Collection | ||||
|      */ | ||||
|     public function getMembers(): Collection; | ||||
|     public function getSources(): Collection; | ||||
| } | ||||
| 
 | ||||
| @@ -1,176 +0,0 @@ | ||||
| <?php | ||||
| namespace App\Entity\Source; | ||||
|  | ||||
| use App\Entity\Source\Attribut\SourceMembersAttribut; | ||||
| use Doctrine\ORM\Mapping as ORM; | ||||
| use Doctrine\Common\Collections\Collection; | ||||
| use Closure; | ||||
|  | ||||
| /** | ||||
|  * | ||||
|  * @author kevinfrantz | ||||
|  * @ORM\Table(name="source_collection") | ||||
|  * @ORM\Entity      | ||||
|  */ | ||||
| class SourceCollection extends AbstractSource implements SourceCollectionInterface | ||||
| { | ||||
|     use SourceMembersAttribut; | ||||
|  | ||||
|     /** | ||||
|      * | ||||
|      * @var Collection | ||||
|      * @ORM\ManyToMany(targetEntity="AbstractSource") | ||||
|      */ | ||||
|     protected $members; | ||||
|      | ||||
|     public function next() | ||||
|     { | ||||
|         return $this->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(); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @@ -1,107 +0,0 @@ | ||||
| <?php | ||||
| namespace App\Entity\Source; | ||||
|  | ||||
| use App\Entity\Source\Attribut\SourceMembersAttributInterface; | ||||
| use Doctrine\Common\Collections\Collection; | ||||
|  | ||||
| /** | ||||
|  * Allows to handle SourceCollections like normal collections. | ||||
|  * This interface also specifies the parameters of the collection interface via PHPDoc | ||||
|  * | ||||
|  * @author kevinfrantz | ||||
|  * @todo Map the not jet mapped functions! | ||||
|  *       | ||||
|  */ | ||||
| interface SourceCollectionInterface extends SourceMembersAttributInterface, Collection | ||||
| { | ||||
|  | ||||
|     /** | ||||
|      * | ||||
|      * @param SourceInterface $element | ||||
|      * @return bool | ||||
|      */ | ||||
|     public function add($element); | ||||
|  | ||||
|     /** | ||||
|      * | ||||
|      * @param SourceInterface $element | ||||
|      * @return bool | ||||
|      */ | ||||
|     public function contains($element); | ||||
|  | ||||
|     /** | ||||
|      * | ||||
|      * @param SourceInterface $element | ||||
|      * @return bool | ||||
|      */ | ||||
|     public function removeElement($element); | ||||
|  | ||||
|     /** | ||||
|      * | ||||
|      * @param string|int $key | ||||
|      * @return SourceInterface|null | ||||
|      */ | ||||
|     public function get($key); | ||||
|  | ||||
|     /** | ||||
|      * | ||||
|      * @return array|SourceInterface[] | ||||
|      */ | ||||
|     public function getValues(); | ||||
|  | ||||
|     /** | ||||
|      * | ||||
|      * @param string|int $key | ||||
|      * @param SourceInterface $value | ||||
|      * @return void | ||||
|      */ | ||||
|     public function set($key, $value); | ||||
|  | ||||
|     /** | ||||
|      * | ||||
|      * @return array|SourceInterface[] | ||||
|      */ | ||||
|     public function toArray(); | ||||
|  | ||||
|     /** | ||||
|      * | ||||
|      * @return SourceInterface | ||||
|      */ | ||||
|     public function first(); | ||||
|  | ||||
|     /** | ||||
|      * | ||||
|      * @return SourceInterface | ||||
|      */ | ||||
|     public function last(); | ||||
|  | ||||
|     /** | ||||
|      * | ||||
|      * @return SourceInterface | ||||
|      */ | ||||
|     public function current(); | ||||
|  | ||||
|     /** | ||||
|      * | ||||
|      * @return SourceInterface | ||||
|      */ | ||||
|     public function next(); | ||||
|  | ||||
|     /** | ||||
|      * | ||||
|      * @param SourceInterface $element | ||||
|      * | ||||
|      * @return int|string|bool | ||||
|      */ | ||||
|     public function indexOf($element); | ||||
|  | ||||
|     /** | ||||
|      * | ||||
|      * @param int $offset | ||||
|      * @param int|null $length | ||||
|      * | ||||
|      * @return array|SourceInterface[] | ||||
|      */ | ||||
|     public function slice($offset, $length = null); | ||||
| } | ||||
|  | ||||
							
								
								
									
										26
									
								
								application/src/Entity/Source/SourcesSource.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								application/src/Entity/Source/SourcesSource.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,26 @@ | ||||
| <?php | ||||
| namespace App\Entity\Source; | ||||
|  | ||||
| use Doctrine\ORM\Mapping as ORM; | ||||
| use Doctrine\Common\Collections\Collection; | ||||
| use App\Entity\Attribut\SourceAttribut; | ||||
| use App\Entity\Source\Attribut\SourcesAttribut; | ||||
|  | ||||
| /** | ||||
|  * | ||||
|  * @author kevinfrantz | ||||
|  * @ORM\Table(name="source_sources") | ||||
|  * @ORM\Entity | ||||
|  */ | ||||
| class SourcesSource extends AbstractSource implements SourcesSourceInterface | ||||
| { | ||||
|     use SourcesAttribut; | ||||
|  | ||||
|     /** | ||||
|      * | ||||
|      * @var Collection | ||||
|      * @ORM\ManyToMany(targetEntity="AbstractSource") | ||||
|      */ | ||||
|     protected $sources; | ||||
| } | ||||
|  | ||||
							
								
								
									
										15
									
								
								application/src/Entity/Source/SourcesSourceInterface.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								application/src/Entity/Source/SourcesSourceInterface.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,15 @@ | ||||
| <?php | ||||
| namespace App\Entity\Source; | ||||
|  | ||||
|  | ||||
| use App\Entity\Source\Attribut\SourcesAttributInterface; | ||||
|  | ||||
| /** | ||||
|  * @author kevinfrantz | ||||
|  * @todo Map the not jet mapped functions! | ||||
|  *       | ||||
|  */ | ||||
| interface SourcesSourceInterface extends SourcesAttributInterface | ||||
| { | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user