mirror of
				https://github.com/kevinveenbirkenbach/infinito.git
				synced 2025-10-31 09:19:08 +00:00 
			
		
		
		
	Optimized Entity draft
This commit is contained in:
		| @@ -7,6 +7,7 @@ use App\Entity\attribut\NodeAttribut; | ||||
| /** | ||||
|  * | ||||
|  * @author kevinfrantz | ||||
|  * @see https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/reference/inheritance-mapping.html | ||||
|  *         | ||||
|  */ | ||||
| abstract class AbstractSource implements SourceInterface | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| <?php | ||||
| namespace App\Entity\attribut; | ||||
| namespace App\Entity\Attribut; | ||||
| 
 | ||||
| /** | ||||
|  * | ||||
| @@ -1,5 +1,5 @@ | ||||
| <?php | ||||
| namespace App\Entity\attribut; | ||||
| namespace App\Entity\Attribut; | ||||
| 
 | ||||
| /** | ||||
|  * | ||||
| @@ -1,5 +1,5 @@ | ||||
| <?php | ||||
| namespace App\Entity\attribut; | ||||
| namespace App\Entity\Attribut; | ||||
| 
 | ||||
| use App\Entity\NodeInterface; | ||||
| 
 | ||||
| @@ -11,6 +11,8 @@ use App\Entity\NodeInterface; | ||||
| trait NodeAttribut{ | ||||
|     /** | ||||
|      * @var NodeInterface | ||||
|      * @OneToOne(targetEntity="Node") | ||||
|      * @JoinColumn(name="source", referencedColumnName="id") | ||||
|      */ | ||||
|     protected $node; | ||||
|      | ||||
| @@ -1,5 +1,5 @@ | ||||
| <?php | ||||
| namespace App\Entity\attribut; | ||||
| namespace App\Entity\Attribut; | ||||
| 
 | ||||
| use App\Entity\NodeInterface; | ||||
| 
 | ||||
							
								
								
									
										29
									
								
								application/src/Entity/Attribut/ParentAttribut.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								application/src/Entity/Attribut/ParentAttribut.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,29 @@ | ||||
| <?php | ||||
| namespace Entity\Attribut; | ||||
|  | ||||
| use Doctrine\Common\Collections\ArrayCollection; | ||||
| use App\Entity\NodeInterface; | ||||
|  | ||||
| /** | ||||
|  * | ||||
|  * @author kevinfrantz | ||||
|  *         | ||||
|  */ | ||||
| trait ParentAttribut { | ||||
|     /** | ||||
|      * | ||||
|      * @var ArrayCollection|NodeInterface[] | ||||
|      */ | ||||
|     protected $parents; | ||||
|      | ||||
|     public function getParents(): ArrayCollection | ||||
|     { | ||||
|         return $this->parents; | ||||
|     } | ||||
|      | ||||
|     public function setParents(ArrayCollection $parents): void | ||||
|     { | ||||
|         $this->parents = $parents; | ||||
|     } | ||||
| } | ||||
|  | ||||
							
								
								
									
										17
									
								
								application/src/Entity/Attribut/ParentsAttributInterface.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								application/src/Entity/Attribut/ParentsAttributInterface.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,17 @@ | ||||
| <?php | ||||
| namespace App\Entity\Attribut; | ||||
|  | ||||
| use Doctrine\Common\Collections\ArrayCollection; | ||||
|  | ||||
| /** | ||||
|  * | ||||
|  * @author kevinfrantz | ||||
|  *         | ||||
|  */ | ||||
| interface ParentsAttributInterface | ||||
| { | ||||
|     public function setParents(ArrayCollection $parents):void; | ||||
|      | ||||
|     public function getParents():ArrayCollection; | ||||
| } | ||||
|  | ||||
| @@ -1,5 +1,5 @@ | ||||
| <?php | ||||
| namespace App\Entity\attribut; | ||||
| namespace App\Entity\Attribut; | ||||
| 
 | ||||
| use App\Entity\SourceInterface; | ||||
| 
 | ||||
| @@ -1,5 +1,5 @@ | ||||
| <?php | ||||
| namespace App\Entity\attribut; | ||||
| namespace App\Entity\Attribut; | ||||
| 
 | ||||
| use App\Entity\SourceInterface; | ||||
| 
 | ||||
| @@ -2,7 +2,7 @@ | ||||
| namespace App\Entity; | ||||
|  | ||||
| /** | ||||
|  * | ||||
|  * This class is not a source! | ||||
|  * @author kevinfrantz | ||||
|  *         | ||||
|  */ | ||||
|   | ||||
| @@ -2,6 +2,9 @@ | ||||
| namespace App\Entity; | ||||
|  | ||||
| use Doctrine\Common\Collections\ArrayCollection; | ||||
| use App\Entity\attribut\IdAttribut; | ||||
| use App\Entity\attribut\SourceAttribut; | ||||
| use Entity\attribut\ParentAttribut; | ||||
|  | ||||
| /** | ||||
|  * | ||||
| @@ -10,50 +13,18 @@ use Doctrine\Common\Collections\ArrayCollection; | ||||
|  */ | ||||
| class Node implements NodeInterface | ||||
| { | ||||
|     /** | ||||
|      *  | ||||
|      * @var int | ||||
|      */ | ||||
|     protected $id; | ||||
|      | ||||
|     /** | ||||
|      *  | ||||
|      * @var SourceInterface | ||||
|      */ | ||||
|     protected $source; | ||||
|      | ||||
|     /** | ||||
|      *  | ||||
|      * @var ArrayCollection|Node[] | ||||
|      */ | ||||
|     protected $parents; | ||||
|     use IdAttribut,SourceAttribut, ParentAttribut; | ||||
|      | ||||
|     /** | ||||
|      *  | ||||
|      * @var ArrayCollection|Node[] | ||||
|      */ | ||||
|     protected $childs; | ||||
|      | ||||
|     public function getParents(): ArrayCollection | ||||
|     {} | ||||
|  | ||||
|     public function setParents(ArrayCollection $parents): void | ||||
|     {} | ||||
|  | ||||
|     public function getChilds(): ArrayCollection | ||||
|     {} | ||||
|  | ||||
|     public function setChilds(ArrayCollection $childs): void | ||||
|     {} | ||||
|      | ||||
|     public function getId(): int | ||||
|     {} | ||||
|  | ||||
|     public function setSource(SourceInterface $source):void | ||||
|     {} | ||||
|  | ||||
|     public function getSource(): SourceInterface | ||||
|     {} | ||||
|  | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -2,21 +2,17 @@ | ||||
| namespace App\Entity; | ||||
|  | ||||
| use Doctrine\Common\Collections\ArrayCollection; | ||||
| use App\Entity\attribut\SourceAttributInterface; | ||||
| use App\Entity\Attribut\SourceAttributInterface; | ||||
| use App\Entity\Attribut\IdAttributInterface; | ||||
| use App\Entity\Attribut\ParentsAttributInterface; | ||||
|  | ||||
| /** | ||||
|  * | ||||
|  * @author kevinfrantz | ||||
|  *         | ||||
|  */ | ||||
| interface NodeInterface extends SourceAttributInterface | ||||
| { | ||||
|     public function getId():int; | ||||
|      | ||||
|     public function setParents(ArrayCollection $parents):void; | ||||
|      | ||||
|     public function getParents():ArrayCollection; | ||||
|      | ||||
| interface NodeInterface extends SourceAttributInterface, IdAttributInterface,ParentsAttributInterface | ||||
| {    | ||||
|     public function setChilds(ArrayCollection $childs):void; | ||||
|      | ||||
|     public function getChilds():ArrayCollection; | ||||
|   | ||||
| @@ -8,7 +8,7 @@ use Doctrine\Common\Collections\ArrayCollection; | ||||
|  * @author kevinfrantz | ||||
|  *         | ||||
|  */ | ||||
| class Property extends AbstractSource implements PropertyInterface | ||||
| class Property implements PropertyInterface | ||||
| { | ||||
|     /** | ||||
|      *  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user