infinito/application/src/Entity/AbstractSource.php
2018-09-14 14:12:43 +02:00

35 lines
878 B
PHP

<?php
namespace App\Entity;
use App\Entity\Attribut\NodeAttribut;
use Doctrine\ORM\Mapping as ORM;
/**
* @author kevinfrantz
*
* @see https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/reference/inheritance-mapping.html
* @ORM\Entity
* @ORM\InheritanceType("JOINED")
* @ORM\DiscriminatorColumn(name="discr", type="string")
* @ORM\DiscriminatorMap({"user" = "UserSource","name" = "NameSource"})
*/
abstract class AbstractSource extends AbstractEntity implements SourceInterface
{
use NodeAttribut;
/**
* @var NodeInterface
* @ORM\OneToOne(targetEntity="Node",cascade={"persist", "remove"})
* @ORM\JoinColumn(name="node_id", referencedColumnName="id")
*/
protected $node;
public function __construct()
{
parent::__construct();
$this->node = new Node();
$this->node->setSource($this);
}
}