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();
}
}

View File

@@ -12,7 +12,7 @@ use App\Entity\Source\Attribut\MembersAttribut;
* @ORM\Table(name="source_group")
* @ORM\Entity
*/
class GroupSource extends AbstractSource implements MembersAttributInterface
final class GroupSource extends AbstractSource implements MembersAttributInterface
{
use MembersAttribut;

View File

@@ -12,7 +12,7 @@ use App\Entity\Source\NameSourceInterface;
* @ORM\Table(name="source_name")
* @ORM\Entity(repositoryClass="App\Repository\NameSourceRepository")
*/
class NameSource extends AbstractSource implements NameSourceInterface
final class NameSource extends AbstractSource implements NameSourceInterface
{
use NameAttribut;

View File

@@ -4,11 +4,12 @@ namespace App\Entity\Source;
use App\Entity\Attribut\IdAttributInterface;
use App\Entity\EntityInterface;
use App\Entity\Source\Attribut\GroupSourcesAttributInterface;
use App\Entity\Attribut\LawAttributInterface;
/**
*
* @author kevinfrantz
*/
interface SourceInterface extends IdAttributInterface, EntityInterface, GroupSourcesAttributInterface
interface SourceInterface extends IdAttributInterface, EntityInterface, GroupSourcesAttributInterface, LawAttributInterface
{
}

View File

@@ -13,7 +13,7 @@ use App\Entity\UserInterface;
* @ORM\Table(name="source_user")
* @ORM\Entity(repositoryClass="App\Repository\UserSourceRepository")
*/
class UserSource extends AbstractSource implements UserSourceInterface
final class UserSource extends AbstractSource implements UserSourceInterface
{
use UserAttribut,NameSourceAttribut;