mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-09-13 21:57:16 +02:00
Optimized folder draft
This commit is contained in:
39
application/src/Entity/Source/AbstractSource.php
Normal file
39
application/src/Entity/Source/AbstractSource.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Entity\Attribut\NodeAttribut;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use JMS\Serializer\Annotation\Exclude;
|
||||
use App\Entity\Interfaces\SourceInterface;
|
||||
use App\Entity\Interfaces\NodeInterface;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*
|
||||
* @see https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/reference/inheritance-mapping.html
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="source")
|
||||
* @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")
|
||||
* @Exclude
|
||||
*/
|
||||
protected $node;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->node = new Node();
|
||||
$this->node->setSource($this);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user