mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-01-09 14:07:25 +01:00
Optimized Entity draft
This commit is contained in:
parent
74038092e3
commit
3d42526698
@ -7,6 +7,7 @@ use App\Entity\attribut\NodeAttribut;
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author kevinfrantz
|
* @author kevinfrantz
|
||||||
|
* @see https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/reference/inheritance-mapping.html
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
abstract class AbstractSource implements SourceInterface
|
abstract class AbstractSource implements SourceInterface
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace App\Entity\attribut;
|
namespace App\Entity\Attribut;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace App\Entity\attribut;
|
namespace App\Entity\Attribut;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace App\Entity\attribut;
|
namespace App\Entity\Attribut;
|
||||||
|
|
||||||
use App\Entity\NodeInterface;
|
use App\Entity\NodeInterface;
|
||||||
|
|
||||||
@ -11,6 +11,8 @@ use App\Entity\NodeInterface;
|
|||||||
trait NodeAttribut{
|
trait NodeAttribut{
|
||||||
/**
|
/**
|
||||||
* @var NodeInterface
|
* @var NodeInterface
|
||||||
|
* @OneToOne(targetEntity="Node")
|
||||||
|
* @JoinColumn(name="source", referencedColumnName="id")
|
||||||
*/
|
*/
|
||||||
protected $node;
|
protected $node;
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace App\Entity\attribut;
|
namespace App\Entity\Attribut;
|
||||||
|
|
||||||
use App\Entity\NodeInterface;
|
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
|
<?php
|
||||||
namespace App\Entity\attribut;
|
namespace App\Entity\Attribut;
|
||||||
|
|
||||||
use App\Entity\SourceInterface;
|
use App\Entity\SourceInterface;
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace App\Entity\attribut;
|
namespace App\Entity\Attribut;
|
||||||
|
|
||||||
use App\Entity\SourceInterface;
|
use App\Entity\SourceInterface;
|
||||||
|
|
@ -2,7 +2,7 @@
|
|||||||
namespace App\Entity;
|
namespace App\Entity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* This class is not a source!
|
||||||
* @author kevinfrantz
|
* @author kevinfrantz
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -2,6 +2,9 @@
|
|||||||
namespace App\Entity;
|
namespace App\Entity;
|
||||||
|
|
||||||
use Doctrine\Common\Collections\ArrayCollection;
|
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
|
class Node implements NodeInterface
|
||||||
{
|
{
|
||||||
/**
|
use IdAttribut,SourceAttribut, ParentAttribut;
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
*/
|
|
||||||
protected $id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @var SourceInterface
|
|
||||||
*/
|
|
||||||
protected $source;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @var ArrayCollection|Node[]
|
|
||||||
*/
|
|
||||||
protected $parents;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var ArrayCollection|Node[]
|
* @var ArrayCollection|Node[]
|
||||||
*/
|
*/
|
||||||
protected $childs;
|
protected $childs;
|
||||||
|
|
||||||
public function getParents(): ArrayCollection
|
|
||||||
{}
|
|
||||||
|
|
||||||
public function setParents(ArrayCollection $parents): void
|
|
||||||
{}
|
|
||||||
|
|
||||||
public function getChilds(): ArrayCollection
|
public function getChilds(): ArrayCollection
|
||||||
{}
|
{}
|
||||||
|
|
||||||
public function setChilds(ArrayCollection $childs): void
|
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;
|
namespace App\Entity;
|
||||||
|
|
||||||
use Doctrine\Common\Collections\ArrayCollection;
|
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
|
* @author kevinfrantz
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
interface NodeInterface extends SourceAttributInterface
|
interface NodeInterface extends SourceAttributInterface, IdAttributInterface,ParentsAttributInterface
|
||||||
{
|
{
|
||||||
public function getId():int;
|
|
||||||
|
|
||||||
public function setParents(ArrayCollection $parents):void;
|
|
||||||
|
|
||||||
public function getParents():ArrayCollection;
|
|
||||||
|
|
||||||
public function setChilds(ArrayCollection $childs):void;
|
public function setChilds(ArrayCollection $childs):void;
|
||||||
|
|
||||||
public function getChilds():ArrayCollection;
|
public function getChilds():ArrayCollection;
|
||||||
|
@ -8,7 +8,7 @@ use Doctrine\Common\Collections\ArrayCollection;
|
|||||||
* @author kevinfrantz
|
* @author kevinfrantz
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class Property extends AbstractSource implements PropertyInterface
|
class Property implements PropertyInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user