mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-01-09 22:17:26 +01:00
Optimized database schema
This commit is contained in:
parent
0a18123384
commit
ad00c57143
@ -11,6 +11,8 @@ use App\DBAL\Types\RecieverType;
|
||||
use App\Entity\Meta\RightInterface;
|
||||
use App\Entity\Meta\RecieverGroupInterface;
|
||||
use App\Entity\Meta\RecieverGroup;
|
||||
use App\Entity\Meta\RecieverInterface;
|
||||
use App\Entity\Meta\Reciever;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
@ -22,7 +24,7 @@ abstract class LawModificator
|
||||
foreach (LayerType::getChoices() as $layerKey => $layerValue) {
|
||||
foreach (RightType::getChoices() as $rightKey => $rightValue) {
|
||||
$right = self::createRight($law, $node, $rightKey, $layerKey);
|
||||
$right->setRecieverGroup(self::createRecieverGroup($node, RecieverType::NODE));
|
||||
//$right->setRecieverGroup(self::createRecieverGroup($node, RecieverType::NODE));
|
||||
$law->getRights()->add($right);
|
||||
}
|
||||
}
|
||||
@ -39,9 +41,9 @@ abstract class LawModificator
|
||||
return $right;
|
||||
}
|
||||
|
||||
public static function createRecieverGroup(RelationInterface $node, string $reciever): RecieverGroupInterface
|
||||
public static function createRecieverGroup(RelationInterface $node, string $reciever): RecieverInterface
|
||||
{
|
||||
$recieverGroup = new RecieverGroup();
|
||||
$recieverGroup = new Reciever();
|
||||
$recieverGroup->setNode($node);
|
||||
$recieverGroup->setReciever($reciever);
|
||||
|
||||
|
@ -11,7 +11,7 @@ use App\Entity\Source\SourceInterface;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
* @ORM\Table(name="meta_reciever_group")
|
||||
* @ORM\Table(name="meta_reciever")
|
||||
* @ORM\Entity()
|
||||
*/
|
||||
class Reciever extends AbstractMeta implements RecieverInterface
|
||||
@ -29,7 +29,7 @@ class Reciever extends AbstractMeta implements RecieverInterface
|
||||
protected $relation;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToMany(targetEntity="App\Entity\AbstractSource")
|
||||
* @ORM\ManyToMany(targetEntity="App\Entity\Source\AbstractSource")
|
||||
* @ORM\JoinTable(name="meta_reciever_members",
|
||||
* joinColumns={@ORM\JoinColumn(name="reciever_id", referencedColumnName="id")},
|
||||
* inverseJoinColumns={@ORM\JoinColumn(name="source_id", referencedColumnName="id")}
|
||||
|
@ -34,26 +34,17 @@ final class Relation extends AbstractMeta implements RelationInterface
|
||||
/**
|
||||
* Parents represent the creators of the relation.
|
||||
*
|
||||
* @ORM\ManyToMany(targetEntity="Relation")
|
||||
* @ORM\JoinTable(name="meta_relation_parents",
|
||||
* joinColumns={@ORM\JoinColumn(name="relation_id", referencedColumnName="id")},
|
||||
* inverseJoinColumns={@ORM\JoinColumn(name="relation_id", referencedColumnName="id")}
|
||||
* )
|
||||
*
|
||||
* @ORM\ManyToMany(targetEntity="Relation",mappedBy="childs")
|
||||
* @var Collection|RelationInterface[]
|
||||
*/
|
||||
protected $parents;
|
||||
|
||||
/**
|
||||
* Childs represent the by the object produced relations.
|
||||
*
|
||||
* @todo Replace this by self referencing
|
||||
*
|
||||
* @see https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/reference/association-mapping.html
|
||||
* @ORM\ManyToMany(targetEntity="Relation")
|
||||
* @ORM\JoinTable(name="meta_relation_childs",
|
||||
* joinColumns={@ORM\JoinColumn(name="relation_id", referencedColumnName="id")},
|
||||
* inverseJoinColumns={@ORM\JoinColumn(name="relation_id", referencedColumnName="id")}
|
||||
* inverseJoinColumns={@ORM\JoinColumn(name="child_id", referencedColumnName="id")}
|
||||
* )
|
||||
*
|
||||
* @var Collection|RelationInterface[]
|
||||
|
@ -41,7 +41,7 @@ final class Right extends AbstractMeta implements RightInterface
|
||||
protected $layer;
|
||||
|
||||
/**
|
||||
* @ORM\OneToOne(targetEntity="RecieverGroup",cascade={"persist", "remove"})
|
||||
* @ORM\OneToOne(targetEntity="Reciever",cascade={"persist", "remove"})
|
||||
* @ORM\JoinColumn(name="reciever_id", referencedColumnName="id")
|
||||
*
|
||||
* @var RecieverInterface
|
||||
|
@ -42,7 +42,7 @@ abstract class AbstractSource extends AbstractEntity implements SourceInterface
|
||||
* @todo Rename table to use the right schema
|
||||
*
|
||||
* @var Collection|GroupSource[]
|
||||
* @ORM\ManyToMany(targetEntity="GroupSource")
|
||||
* @ORM\ManyToMany(targetEntity="GroupSource",mappedBy="members")
|
||||
*/
|
||||
protected $groups;
|
||||
|
||||
|
@ -19,7 +19,8 @@ final class GroupSource extends AbstractSource implements MembersAttributInterfa
|
||||
|
||||
/**
|
||||
* @var Collection
|
||||
* @ORM\ManyToMany(targetEntity="AbstractSource")
|
||||
* @ORM\ManyToMany(targetEntity="AbstractSource",inversedBy="groups")
|
||||
* @ORM\JoinTable(name="source_group_members")
|
||||
*/
|
||||
protected $members;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user