In between commit refactoring and implementing tests

This commit is contained in:
Kevin Frantz
2018-10-28 20:28:29 +01:00
parent 89396dfef3
commit de51649d63
21 changed files with 105 additions and 148 deletions

View File

@@ -1,5 +1,4 @@
<?php
namespace App\Entity\Source;
use Doctrine\ORM\Mapping as ORM;
@@ -10,10 +9,15 @@ use App\Entity\Source\Attribut\GroupSourcesAttribut;
use App\Entity\Meta\RelationInterface;
use App\Entity\Attribut\RelationAttribut;
use App\Entity\Meta\Relation;
use App\Entity\Attribut\LawAttribut;
use App\Entity\Meta\LawInterface;
use App\Entity\Meta\Law;
use Doctrine\Common\Collections\ArrayCollection;
/**
* @author kevinfrantz
*
* @author kevinfrantz
*
* @see https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/reference/inheritance-mapping.html
* @ORM\Entity
* @ORM\Table(name="source")
@@ -23,9 +27,10 @@ use App\Entity\Meta\Relation;
*/
abstract class AbstractSource extends AbstractEntity implements SourceInterface
{
use RelationAttribut,GroupSourcesAttribut;
use RelationAttribut,GroupSourcesAttribut, LawAttribut;
/**
*
* @var RelationInterface
* @ORM\OneToOne(targetEntity="App\Entity\Meta\Relation",cascade={"persist", "remove"})
* @ORM\JoinColumn(name="relation_id", referencedColumnName="id")
@@ -34,17 +39,29 @@ abstract class AbstractSource extends AbstractEntity implements SourceInterface
protected $relation;
/**
*
* @todo Implement that just one table on database level is needed!
* @todo Rename table to use the right schema
* @var Collection|GroupSource[]
* @ORM\ManyToMany(targetEntity="GroupSource")
*/
protected $groups;
/**
*
* @ORM\OneToOne(targetEntity="Law",cascade={"persist", "remove"})
* @ORM\JoinColumn(name="law_id", referencedColumnName="id")
*
* @var LawInterface
*/
protected $law;
public function __construct()
{
parent::__construct();
$this->relation = new Relation();
$this->relation->setSource($this);
$this->law = new Law();
$this->groups = new ArrayCollection();
}
}