Optimized Entity draft

This commit is contained in:
Kevin Frantz
2018-09-06 13:52:34 +02:00
parent 74038092e3
commit 3d42526698
13 changed files with 66 additions and 50 deletions

View File

@@ -0,0 +1,27 @@
<?php
namespace App\Entity\Attribut;
/**
*
* @author kevinfrantz
*
*/
trait IdAttribut {
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")(strategy="AUTO")
*/
protected $id;
public function setId(int $id): void
{
$this->id = $id;
}
public function getId(): int
{
return $this->id;
}
}

View File

@@ -0,0 +1,15 @@
<?php
namespace App\Entity\Attribut;
/**
*
* @author kevinfrantz
*
*/
interface IdAttributInterface
{
public function setId(int $id): void;
public function getId(): int;
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Entity\Attribut;
use App\Entity\NodeInterface;
/**
*
* @author kevinfrantz
*
*/
trait NodeAttribut{
/**
* @var NodeInterface
* @OneToOne(targetEntity="Node")
* @JoinColumn(name="source", referencedColumnName="id")
*/
protected $node;
public function setNode(NodeInterface $node): void
{
$this->node = $node;
}
public function getNode(): NodeInterface
{
return $this->node;
}
}

View File

@@ -0,0 +1,17 @@
<?php
namespace App\Entity\Attribut;
use App\Entity\NodeInterface;
/**
*
* @author kevinfrantz
*
*/
interface NodeAttributInterface
{
public function setNode(NodeInterface $node):void;
public function getNode():NodeInterface;
}

View 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;
}
}

View 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;
}

View File

@@ -0,0 +1,25 @@
<?php
namespace App\Entity\Attribut;
use App\Entity\SourceInterface;
/**
*
* @author kevinfrantz
*
*/
trait SourceAttribut {
/**
* @var SourceInterface
*/
protected $source;
public function getSource():SourceInterface{
return $this->source;
}
public function setSource(SourceInterface $source):void{
$this->source = $source;
}
}

View File

@@ -0,0 +1,17 @@
<?php
namespace App\Entity\Attribut;
use App\Entity\SourceInterface;
/**
*
* @author kevinfrantz
*
*/
interface SourceAttributInterface
{
public function getSource():SourceInterface;
public function setSource(SourceInterface $source):void;
}