Formated code and optimized orm mapping

This commit is contained in:
Kevin Frantz 2018-11-25 23:29:00 +01:00
parent 1252f41127
commit 6be1a09b30
4 changed files with 19 additions and 11 deletions

View File

@ -4,8 +4,6 @@ namespace App\Entity\Meta;
use App\Entity\AbstractEntity;
use App\Entity\Attribut\SourceAttribut;
use App\Entity\Source\SourceInterface;
use Doctrine\ORM\Mapping as ORM;
/**
* @todo Implement source attribut
@ -16,14 +14,6 @@ abstract class AbstractMeta extends AbstractEntity implements MetaInterface
{
use SourceAttribut;
/**
* @ORM\OneToOne(targetEntity="App\Entity\Source\AbstractSource",cascade={"persist", "remove"})
* @ORM\JoinColumn(name="source_id", referencedColumnName="id",onDelete="CASCADE")
*
* @var SourceInterface
*/
protected $source;
public function __construct()
{
parent::__construct();

View File

@ -6,6 +6,7 @@ use Doctrine\ORM\Mapping as ORM;
use App\Entity\Attribut\RightsAttribute;
use Doctrine\Common\Collections\ArrayCollection;
use App\Entity\Attribut\RelationAttribut;
use App\Entity\Source\SourceInterface;
/**
* @author kevinfrantz
@ -16,6 +17,14 @@ class Law extends AbstractMeta implements LawInterface
{
use RightsAttribute, RelationAttribut;
/**
* @ORM\OneToOne(targetEntity="App\Entity\Source\AbstractSource",cascade={"persist", "remove"})
* @ORM\JoinColumn(name="source_id", referencedColumnName="id",onDelete="CASCADE")
*
* @var SourceInterface
*/
protected $source;
/**
* @ORM\OneToMany(targetEntity="Right", mappedBy="law", cascade={"persist", "remove"})
*

View File

@ -5,6 +5,7 @@ namespace App\Entity\Meta\Relation\Parent;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\Collection;
use App\Entity\Meta\Relation\CreatorRelationInterface;
use App\Entity\Source\SourceInterface;
/**
* @author kevinfrantz
@ -12,6 +13,14 @@ use App\Entity\Meta\Relation\CreatorRelationInterface;
*/
class CreatorRelation extends AbstractParentRelation
{
/**
* @ORM\OneToOne(targetEntity="App\Entity\Source\AbstractSource",cascade={"persist", "remove"})
* @ORM\JoinColumn(name="source_id", referencedColumnName="id",onDelete="CASCADE")
*
* @var SourceInterface
*/
protected $source;
/**
* @ORM\ManyToMany(targetEntity="CreatorRelation",mappedBy="childs")
*

View File

@ -88,7 +88,7 @@ abstract class AbstractSource extends AbstractEntity implements SourceInterface
/**
* @ORM\OneToOne(targetEntity="App\Entity\Meta\Law",cascade={"persist", "remove"})
* @ORM\JoinColumn(name="law_id", referencedColumnName="id")
* @ORM\JoinColumn(name="law_id", referencedColumnName="id", onDelete="CASCADE")
*
* @var LawInterface
*/