Entity draft

This commit is contained in:
Kevin Frantz 2018-09-06 12:58:36 +02:00
parent 9520b09db0
commit 2a1f3bd264
12 changed files with 143 additions and 59 deletions

View File

@ -1,18 +1,17 @@
<?php <?php
namespace App\Entity; namespace App\Entity;
use App\Entity\attribut\IdAttribut;
use App\Entity\attribut\NodeAttribut;
/** /**
* *
* @author kevinfrantz * @author kevinfrantz
* *
*/ */
class AbstractSource implements SourceInterface abstract class AbstractSource implements SourceInterface
{ {
/** use IdAttribut,NodeAttribut;
*
* @var Node
*/
protected $node;
/** /**
* *
@ -20,22 +19,4 @@ class AbstractSource implements SourceInterface
*/ */
protected $configuration; protected $configuration;
/**
*
* @var int
*/
protected $id;
public function setId(int $id): void
{}
public function setNode(NodeInterface $node): void
{}
public function getId(): int
{}
public function getNode(): NodeInterface
{}
} }

View File

@ -6,7 +6,7 @@ namespace App\Entity;
* @author kevinfrantz * @author kevinfrantz
* *
*/ */
class Configuration extends AbstractSource implements ConfigurationInterface class Configuration implements ConfigurationInterface
{ {
/** /**
* *
@ -25,6 +25,7 @@ class Configuration extends AbstractSource implements ConfigurationInterface
* @var PropertyInterface * @var PropertyInterface
*/ */
protected $administrate; protected $administrate;
public function setAdministrate(Property $administrate): void public function setAdministrate(Property $administrate): void
{} {}

View File

@ -2,13 +2,14 @@
namespace App\Entity; namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Entity\attribut\SourceAttributInterface;
/** /**
* *
* @author kevinfrantz * @author kevinfrantz
* *
*/ */
interface NodeInterface interface NodeInterface extends SourceAttributInterface
{ {
public function getId():int; public function getId():int;
@ -19,9 +20,5 @@ interface NodeInterface
public function setChilds(ArrayCollection $childs):void; public function setChilds(ArrayCollection $childs):void;
public function getChilds():ArrayCollection; public function getChilds():ArrayCollection;
public function getSource():SourceInterface;
public function setSource(SourceInterface $source):void;
} }

View File

@ -1,19 +1,15 @@
<?php <?php
namespace App\Entity; namespace App\Entity;
use App\Entity\attribut\NodeAttributInterface;
use App\Entity\attribut\IdAttributInterface;
/** /**
* *
* @author kevinfrantz * @author kevinfrantz
* *
*/ */
interface SourceInterface interface SourceInterface extends IdAttributInterface, NodeAttributInterface
{ {
public function setId(int $id):void;
public function getId():int;
public function setNode(NodeInterface $node):void;
public function getNode():NodeInterface;
} }

View File

@ -9,15 +9,8 @@ use Symfony\Component\Security\Core\User\UserInterface;
* @ORM\Table(name="source_user") * @ORM\Table(name="source_user")
* @ORM\Entity(repositoryClass="App\Repository\UserRepository") * @ORM\Entity(repositoryClass="App\Repository\UserRepository")
*/ */
class User implements UserInterface, \Serializable class User extends AbstractSource implements UserInterface, \Serializable
{ {
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/** /**
* @ORM\Column(type="string", length=25, unique=true) * @ORM\Column(type="string", length=25, unique=true)
*/ */

View File

@ -1,13 +0,0 @@
<?php
namespace App\Entity;
/**
*
* @author kevinfrantz
*
*/
interface UserInterface
{
}

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,28 @@
<?php
namespace App\Entity\attribut;
use App\Entity\NodeInterface;
/**
*
* @author kevinfrantz
*
*/
trait NodeAttribut{
/**
* @var NodeInterface
*/
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,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;
}