mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-09-13 13:57:10 +02:00
In between commit refactoring and implementing tests
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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
|
||||
{
|
||||
}
|
||||
|
@@ -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;
|
||||
|
||||
|
Reference in New Issue
Block a user