Optimized ORM Modell

This commit is contained in:
Kevin Frantz 2018-09-06 14:52:01 +02:00
parent bccafb4740
commit 261b704017
2 changed files with 7 additions and 2 deletions

View File

@ -9,7 +9,10 @@ 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" = "User"})
*/
abstract class AbstractSource implements SourceInterface
{

View File

@ -10,6 +10,8 @@ use App\Entity\SourceInterface;
*/
trait SourceAttribut {
/**
* @ORM\OneToOne(targetEntity="AbstractSource")
* @ORM\JoinColumn(name="source_id", referencedColumnName="id")
* @var SourceInterface
*/
protected $source;