infinito/application/src/Entity/AbstractSource.php

35 lines
878 B
PHP
Raw Normal View History

2018-09-05 15:46:14 +02:00
<?php
2018-09-12 23:25:22 +03:00
2018-09-05 15:46:14 +02:00
namespace App\Entity;
2018-09-06 14:03:08 +02:00
use App\Entity\Attribut\NodeAttribut;
use Doctrine\ORM\Mapping as ORM;
2018-09-06 12:58:36 +02:00
2018-09-05 15:46:14 +02:00
/**
* @author kevinfrantz
2018-09-12 23:25:22 +03:00
*
2018-09-06 13:52:34 +02:00
* @see https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/reference/inheritance-mapping.html
2018-09-06 14:52:01 +02:00
* @ORM\Entity
* @ORM\InheritanceType("JOINED")
* @ORM\DiscriminatorColumn(name="discr", type="string")
2018-09-14 14:12:43 +02:00
* @ORM\DiscriminatorMap({"user" = "UserSource","name" = "NameSource"})
2018-09-05 15:46:14 +02:00
*/
2018-09-13 14:39:03 +02:00
abstract class AbstractSource extends AbstractEntity implements SourceInterface
2018-09-12 23:25:22 +03:00
{
2018-09-13 14:39:03 +02:00
use NodeAttribut;
2018-09-13 16:51:58 +02:00
2018-09-13 14:39:03 +02:00
/**
* @var NodeInterface
* @ORM\OneToOne(targetEntity="Node",cascade={"persist", "remove"})
* @ORM\JoinColumn(name="node_id", referencedColumnName="id")
*/
protected $node;
2018-09-13 16:51:58 +02:00
public function __construct()
{
2018-09-13 22:35:32 +02:00
parent::__construct();
2018-09-13 12:29:07 +02:00
$this->node = new Node();
2018-09-13 14:39:03 +02:00
$this->node->setSource($this);
2018-09-13 12:29:07 +02:00
}
2018-09-12 23:25:22 +03:00
}