mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-01-09 14:07:25 +01:00
Refactored relation and node draft
This commit is contained in:
parent
7734f57c63
commit
a95ff0497e
@ -1,26 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Entity\Attribut;
|
|
||||||
|
|
||||||
use App\Entity\NodeInterface;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kevinfrantz
|
|
||||||
*/
|
|
||||||
trait NodeAttribut
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @var NodeInterface
|
|
||||||
*/
|
|
||||||
protected $node;
|
|
||||||
|
|
||||||
public function setNode(NodeInterface $node): void
|
|
||||||
{
|
|
||||||
$this->node = $node;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getNode(): NodeInterface
|
|
||||||
{
|
|
||||||
return $this->node;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Entity\Attribut;
|
|
||||||
|
|
||||||
use App\Entity\NodeInterface;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kevinfrantz
|
|
||||||
*/
|
|
||||||
interface NodeAttributInterface
|
|
||||||
{
|
|
||||||
public function setNode(NodeInterface $node): void;
|
|
||||||
|
|
||||||
public function getNode(): NodeInterface;
|
|
||||||
}
|
|
26
application/src/Entity/Attribut/RelationAttribut.php
Normal file
26
application/src/Entity/Attribut/RelationAttribut.php
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Entity\Attribut;
|
||||||
|
|
||||||
|
use App\Entity\RelationInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kevinfrantz
|
||||||
|
*/
|
||||||
|
trait RelationAttribut
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var RelationInterface
|
||||||
|
*/
|
||||||
|
protected $relation;
|
||||||
|
|
||||||
|
public function setRelation(RelationInterface $relation): void
|
||||||
|
{
|
||||||
|
$this->relation = $relation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRelation(): RelationInterface
|
||||||
|
{
|
||||||
|
return $this->relation;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Entity\Attribut;
|
||||||
|
|
||||||
|
use App\Entity\RelationInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kevinfrantz
|
||||||
|
*/
|
||||||
|
interface RelationAttributInterface
|
||||||
|
{
|
||||||
|
public function setRelation(RelationInterface $relation): void;
|
||||||
|
|
||||||
|
public function getRelation(): RelationInterface;
|
||||||
|
}
|
@ -5,7 +5,7 @@ namespace App\Entity;
|
|||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
use App\Entity\Attribut\RightsAttribute;
|
use App\Entity\Attribut\RightsAttribute;
|
||||||
use Doctrine\Common\Collections\ArrayCollection;
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
use App\Entity\Attribut\NodeAttribut;
|
use App\Entity\Attribut\RelationAttribut;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author kevinfrantz
|
* @author kevinfrantz
|
||||||
@ -14,7 +14,7 @@ use App\Entity\Attribut\NodeAttribut;
|
|||||||
*/
|
*/
|
||||||
class Law extends AbstractEntity implements LawInterface
|
class Law extends AbstractEntity implements LawInterface
|
||||||
{
|
{
|
||||||
use RightsAttribute, NodeAttribut;
|
use RightsAttribute, RelationAttribut;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\OneToMany(targetEntity="Right", mappedBy="law", cascade={"persist", "remove"})
|
* @ORM\OneToMany(targetEntity="Right", mappedBy="law", cascade={"persist", "remove"})
|
||||||
@ -24,12 +24,12 @@ class Law extends AbstractEntity implements LawInterface
|
|||||||
protected $rights;
|
protected $rights;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\OneToOne(targetEntity="Node",cascade={"persist", "remove"})
|
* @ORM\OneToOne(targetEntity="Relation",cascade={"persist", "remove"})
|
||||||
* @ORM\JoinColumn(name="node_id", referencedColumnName="id")
|
* @ORM\JoinColumn(name="relation_id", referencedColumnName="id")
|
||||||
*
|
*
|
||||||
* @var NodeInterface
|
* @var RelationInterface
|
||||||
*/
|
*/
|
||||||
protected $node;
|
protected $relation;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@ -41,13 +41,13 @@ class Law extends AbstractEntity implements LawInterface
|
|||||||
$this->rights = new ArrayCollection();
|
$this->rights = new ArrayCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isGranted(NodeInterface $node, string $layer, string $right): bool
|
public function isGranted(RelationInterface $relation, string $layer, string $right): bool
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var RightInterface
|
* @var RightInterface
|
||||||
*/
|
*/
|
||||||
foreach ($this->rights->toArray() as $right) {
|
foreach ($this->rights->toArray() as $right) {
|
||||||
if ($right->isGranted($node, $layer, $right)) {
|
if ($right->isGranted($relation, $layer, $right)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,12 +3,12 @@
|
|||||||
namespace App\Entity;
|
namespace App\Entity;
|
||||||
|
|
||||||
use App\Entity\Attribut\RightsAttributInterface;
|
use App\Entity\Attribut\RightsAttributInterface;
|
||||||
use App\Entity\Method\NodeGrantedInterface;
|
use App\Entity\Attribut\RelationAttributInterface;
|
||||||
use App\Entity\Attribut\NodeAttributInterface;
|
use App\Entity\Method\RelationGrantedInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author kevinfrantz
|
* @author kevinfrantz
|
||||||
*/
|
*/
|
||||||
interface LawInterface extends RightsAttributInterface, NodeGrantedInterface, NodeAttributInterface
|
interface LawInterface extends RightsAttributInterface, RelationGrantedInterface, RelationAttributInterface
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Entity\Method;
|
|
||||||
|
|
||||||
use App\Entity\NodeInterface;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kevinfrantz
|
|
||||||
*/
|
|
||||||
interface NodeGrantedInterface
|
|
||||||
{
|
|
||||||
public function isGranted(NodeInterface $node, string $layer, string $right): bool;
|
|
||||||
}
|
|
13
application/src/Entity/Method/RelationGrantedInterface.php
Normal file
13
application/src/Entity/Method/RelationGrantedInterface.php
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Entity\Method;
|
||||||
|
|
||||||
|
use App\Entity\RelationInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kevinfrantz
|
||||||
|
*/
|
||||||
|
interface RelationGrantedInterface
|
||||||
|
{
|
||||||
|
public function isGranted(RelationInterface $relation, string $layer, string $right): bool;
|
||||||
|
}
|
@ -2,13 +2,14 @@
|
|||||||
|
|
||||||
namespace App\Entity;
|
namespace App\Entity;
|
||||||
|
|
||||||
use App\Entity\Attribut\NodeAttribut;
|
|
||||||
use App\Entity\Attribut\RecieverAttribut;
|
use App\Entity\Attribut\RecieverAttribut;
|
||||||
use Doctrine\Common\Collections\ArrayCollection;
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
use App\DBAL\Types\RecieverType;
|
use App\DBAL\Types\RecieverType;
|
||||||
use Symfony\Component\Intl\Exception\NotImplementedException;
|
use Symfony\Component\Intl\Exception\NotImplementedException;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
use Fresh\DoctrineEnumBundle\Validator\Constraints as DoctrineAssert;
|
use Fresh\DoctrineEnumBundle\Validator\Constraints as DoctrineAssert;
|
||||||
|
use App\Entity\Attribut\RelationAttribut;
|
||||||
|
use App\Entity\Attribut\RelationAttributInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author kevinfrantz
|
* @author kevinfrantz
|
||||||
@ -17,7 +18,7 @@ use Fresh\DoctrineEnumBundle\Validator\Constraints as DoctrineAssert;
|
|||||||
*/
|
*/
|
||||||
class RecieverGroup extends AbstractEntity implements RecieverGroupInterface
|
class RecieverGroup extends AbstractEntity implements RecieverGroupInterface
|
||||||
{
|
{
|
||||||
use NodeAttribut,RecieverAttribut;
|
use RelationAttribut,RecieverAttribut;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(name="reciever", type="RecieverType", nullable=false)
|
* @ORM\Column(name="reciever", type="RecieverType", nullable=false)
|
||||||
@ -30,12 +31,12 @@ class RecieverGroup extends AbstractEntity implements RecieverGroupInterface
|
|||||||
/**
|
/**
|
||||||
* The node for which the right exists.
|
* The node for which the right exists.
|
||||||
*
|
*
|
||||||
* @ORM\ManyToOne(targetEntity="Node")
|
* @ORM\ManyToOne(targetEntity="Relation")
|
||||||
* @ORM\JoinColumn(name="node_id", referencedColumnName="id")
|
* @ORM\JoinColumn(name="relation_id", referencedColumnName="id")
|
||||||
*
|
*
|
||||||
* @var NodeInterface
|
* @var RelationAttributInterface
|
||||||
*/
|
*/
|
||||||
protected $node;
|
protected $relation;
|
||||||
|
|
||||||
public function getAllRecievers(): ArrayCollection
|
public function getAllRecievers(): ArrayCollection
|
||||||
{
|
{
|
||||||
|
@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
namespace App\Entity;
|
namespace App\Entity;
|
||||||
|
|
||||||
use App\Entity\Attribut\NodeAttributInterface;
|
|
||||||
use App\Entity\Attribut\RecieverAttributInterface;
|
use App\Entity\Attribut\RecieverAttributInterface;
|
||||||
use Doctrine\Common\Collections\ArrayCollection;
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
|
use App\Entity\Attribut\RelationAttributInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author kevinfrantz
|
* @author kevinfrantz
|
||||||
*/
|
*/
|
||||||
interface RecieverGroupInterface extends NodeAttributInterface, RecieverAttributInterface
|
interface RecieverGroupInterface extends RelationAttributInterface, RecieverAttributInterface
|
||||||
{
|
{
|
||||||
public function getAllRecievers(): ArrayCollection;
|
public function getAllRecievers(): ArrayCollection;
|
||||||
}
|
}
|
||||||
|
@ -13,12 +13,15 @@ use App\Entity\Source\SourceInterface;
|
|||||||
use Doctrine\Common\Collections\Collection;
|
use Doctrine\Common\Collections\Collection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* This class represents a relation.
|
||||||
|
* It allows a better right management of the meta informations.
|
||||||
|
* Also it is used to capsel the logic relation to an own logical unit.
|
||||||
* @author kevinfrantz
|
* @author kevinfrantz
|
||||||
* @todo rename and refactor this class
|
* @todo rename and refactor this class
|
||||||
* @ORM\Table(name="node")
|
* @ORM\Table(name="node")
|
||||||
* @ORM\Entity()
|
* @ORM\Entity()
|
||||||
*/
|
*/
|
||||||
class Node extends AbstractEntity implements NodeInterface
|
class Relation extends AbstractEntity implements RelationInterface
|
||||||
{
|
{
|
||||||
use IdAttribut,
|
use IdAttribut,
|
||||||
SourceAttribut,
|
SourceAttribut,
|
||||||
@ -27,28 +30,28 @@ class Node extends AbstractEntity implements NodeInterface
|
|||||||
ChildsAttribut;
|
ChildsAttribut;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Many Nodes have many parents.
|
* Parents represent the creators of the relation
|
||||||
* @ORM\ManyToMany(targetEntity="Node")
|
* @ORM\ManyToMany(targetEntity="Relation")
|
||||||
* @ORM\JoinTable(name="nodes_parents",
|
* @ORM\JoinTable(name="relation_parents",
|
||||||
* joinColumns={@ORM\JoinColumn(name="node_id", referencedColumnName="id")},
|
* joinColumns={@ORM\JoinColumn(name="relation_id", referencedColumnName="id")},
|
||||||
* inverseJoinColumns={@ORM\JoinColumn(name="node_id", referencedColumnName="id")}
|
* inverseJoinColumns={@ORM\JoinColumn(name="relation_id", referencedColumnName="id")}
|
||||||
* )
|
* )
|
||||||
*
|
*
|
||||||
* @var Collection|NodeInterface[]
|
* @var Collection|RelationInterface[]
|
||||||
*/
|
*/
|
||||||
protected $parents;
|
protected $parents;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Many Nodes have many childs.
|
* Childs represent the by the object produced relations
|
||||||
* @todo Replace this by self referencing
|
* @todo Replace this by self referencing
|
||||||
* @see https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/reference/association-mapping.html
|
* @see https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/reference/association-mapping.html
|
||||||
* @ORM\ManyToMany(targetEntity="Node")
|
* @ORM\ManyToMany(targetEntity="Relation")
|
||||||
* @ORM\JoinTable(name="nodes_childs",
|
* @ORM\JoinTable(name="relation_childs",
|
||||||
* joinColumns={@ORM\JoinColumn(name="node_id", referencedColumnName="id")},
|
* joinColumns={@ORM\JoinColumn(name="relation_id", referencedColumnName="id")},
|
||||||
* inverseJoinColumns={@ORM\JoinColumn(name="node_id", referencedColumnName="id")}
|
* inverseJoinColumns={@ORM\JoinColumn(name="relation_id", referencedColumnName="id")}
|
||||||
* )
|
* )
|
||||||
*
|
*
|
||||||
* @var Collection|NodeInterface[]
|
* @var Collection|RelationInterface[]
|
||||||
*/
|
*/
|
||||||
protected $childs;
|
protected $childs;
|
||||||
|
|
@ -11,6 +11,6 @@ use App\Entity\Attribut\LawAttributInterface;
|
|||||||
/**
|
/**
|
||||||
* @author kevinfrantz
|
* @author kevinfrantz
|
||||||
*/
|
*/
|
||||||
interface NodeInterface extends SourceAttributInterface, IdAttributInterface, ParentsAttributInterface, ChildsAttributeInterface, LawAttributInterface
|
interface RelationInterface extends SourceAttributInterface, IdAttributInterface, ParentsAttributInterface, ChildsAttributeInterface, LawAttributInterface
|
||||||
{
|
{
|
||||||
}
|
}
|
@ -8,16 +8,12 @@ use Fresh\DoctrineEnumBundle\Validator\Constraints as DoctrineAssert;
|
|||||||
use App\Entity\Attribut\LawAttribut;
|
use App\Entity\Attribut\LawAttribut;
|
||||||
use App\DBAL\Types\LayerType;
|
use App\DBAL\Types\LayerType;
|
||||||
use App\DBAL\Types\RightType;
|
use App\DBAL\Types\RightType;
|
||||||
use App\Entity\Attribut\NodeAttribut;
|
|
||||||
use App\Entity\Attribut\GrantAttribut;
|
use App\Entity\Attribut\GrantAttribut;
|
||||||
use App\Logic\Operation\OperationInterface;
|
use App\Logic\Operation\OperationInterface;
|
||||||
use App\Entity\Attribut\ConditionAttribut;
|
use App\Entity\Attribut\ConditionAttribut;
|
||||||
use App\Entity\Attribut\RecieverGroupAttribut;
|
use App\Entity\Attribut\RecieverGroupAttribut;
|
||||||
use App\Entity\Attribut\LayerAttribut;
|
use App\Entity\Attribut\LayerAttribut;
|
||||||
use App\Entity\LawInterface;
|
use App\Entity\Attribut\RelationAttribut;
|
||||||
use App\Entity\RecieverGroupInterface;
|
|
||||||
use App\Entity\NodeInterface;
|
|
||||||
use App\Entity\RightInterface;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author kevinfrantz
|
* @author kevinfrantz
|
||||||
@ -26,7 +22,7 @@ use App\Entity\RightInterface;
|
|||||||
*/
|
*/
|
||||||
class Right extends AbstractEntity implements RightInterface
|
class Right extends AbstractEntity implements RightInterface
|
||||||
{
|
{
|
||||||
use TypeAttribut,LawAttribut, NodeAttribut, GrantAttribut,ConditionAttribut,RecieverGroupAttribut,LayerAttribut;
|
use TypeAttribut,LawAttribut, RelationAttribut, GrantAttribut,ConditionAttribut,RecieverGroupAttribut,LayerAttribut;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToOne(targetEntity="Law", inversedBy="rights")
|
* @ORM\ManyToOne(targetEntity="Law", inversedBy="rights")
|
||||||
@ -60,12 +56,12 @@ class Right extends AbstractEntity implements RightInterface
|
|||||||
protected $grant;
|
protected $grant;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToOne(targetEntity="Node")
|
* @ORM\ManyToOne(targetEntity="Relation")
|
||||||
* @ORM\JoinColumn(name="node_id", referencedColumnName="id")
|
* @ORM\JoinColumn(name="relation_id", referencedColumnName="id")
|
||||||
*
|
*
|
||||||
* @var NodeInterface
|
* @var RelationInterface
|
||||||
*/
|
*/
|
||||||
protected $node;
|
protected $relation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(name="type", type="RightType", nullable=false)
|
* @ORM\Column(name="type", type="RightType", nullable=false)
|
||||||
@ -91,9 +87,9 @@ class Right extends AbstractEntity implements RightInterface
|
|||||||
//$this->recieverGroup = new RecieverGroup();
|
//$this->recieverGroup = new RecieverGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isGranted(NodeInterface $node, string $layer, string $right): bool
|
public function isGranted(RelationInterface $relation, string $layer, string $right): bool
|
||||||
{
|
{
|
||||||
if ($this->layer == $layer && $this->type == $right && $this->checkIfNodeIsReciever($node) && $this->getConditionBoolOrTrue()) {
|
if ($this->layer == $layer && $this->type == $right && $this->checkIfNodeIsReciever($relation) && $this->getConditionBoolOrTrue()) {
|
||||||
return $this->grant;
|
return $this->grant;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,8 +105,8 @@ class Right extends AbstractEntity implements RightInterface
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function checkIfNodeIsReciever(NodeInterface $node): bool
|
private function checkIfNodeIsReciever(RelationInterface $relation): bool
|
||||||
{
|
{
|
||||||
return $this->recieverGroup->getAllRecievers()->contains($node);
|
return $this->recieverGroup->getAllRecievers()->contains($relation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,16 +4,16 @@ namespace App\Entity;
|
|||||||
|
|
||||||
use App\Entity\Attribut\TypeAttributInterface;
|
use App\Entity\Attribut\TypeAttributInterface;
|
||||||
use App\Entity\Attribut\LawAttributInterface;
|
use App\Entity\Attribut\LawAttributInterface;
|
||||||
use App\Entity\Method\NodeGrantedInterface;
|
|
||||||
use App\Entity\Attribut\RecieverGroupAttributInterface;
|
use App\Entity\Attribut\RecieverGroupAttributInterface;
|
||||||
use App\Entity\Attribut\GrantAttributInterface;
|
use App\Entity\Attribut\GrantAttributInterface;
|
||||||
use App\Entity\Attribut\NodeAttributInterface;
|
|
||||||
use App\Entity\Attribut\ConditionAttributInterface;
|
use App\Entity\Attribut\ConditionAttributInterface;
|
||||||
use App\Entity\Attribut\LayerAttributInterface;
|
use App\Entity\Attribut\LayerAttributInterface;
|
||||||
|
use App\Entity\Method\RelationGrantedInterface;
|
||||||
|
use App\Entity\Attribut\RelationAttributInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author kevinfrantz
|
* @author kevinfrantz
|
||||||
*/
|
*/
|
||||||
interface RightInterface extends TypeAttributInterface, LawAttributInterface, NodeGrantedInterface, GrantAttributInterface, RecieverGroupAttributInterface, NodeAttributInterface, ConditionAttributInterface, LayerAttributInterface
|
interface RightInterface extends TypeAttributInterface, LawAttributInterface, RelationGrantedInterface, GrantAttributInterface, RecieverGroupAttributInterface, RelationAttributInterface, ConditionAttributInterface, LayerAttributInterface
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -2,12 +2,14 @@
|
|||||||
|
|
||||||
namespace App\Entity\Source;
|
namespace App\Entity\Source;
|
||||||
|
|
||||||
use App\Entity\Attribut\NodeAttribut;
|
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
use JMS\Serializer\Annotation\Exclude;
|
use JMS\Serializer\Annotation\Exclude;
|
||||||
use App\Entity\NodeInterface;
|
|
||||||
use App\Entity\AbstractEntity;
|
use App\Entity\AbstractEntity;
|
||||||
use App\Entity\Node;
|
use Doctrine\Common\Collections\Collection;
|
||||||
|
use App\Entity\Source\Attribut\GroupSourcesAttribut;
|
||||||
|
use App\Entity\RelationInterface;
|
||||||
|
use App\Entity\Attribut\RelationAttribut;
|
||||||
|
use App\Entity\Relation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author kevinfrantz
|
* @author kevinfrantz
|
||||||
@ -17,24 +19,30 @@ use App\Entity\Node;
|
|||||||
* @ORM\Table(name="source")
|
* @ORM\Table(name="source")
|
||||||
* @ORM\InheritanceType("JOINED")
|
* @ORM\InheritanceType("JOINED")
|
||||||
* @ORM\DiscriminatorColumn(name="discr", type="string")
|
* @ORM\DiscriminatorColumn(name="discr", type="string")
|
||||||
* @ORM\DiscriminatorMap({"user" = "UserSource","name" = "NameSource","collection" = "SourcesSource"})
|
* @ORM\DiscriminatorMap({"user" = "UserSource","name" = "NameSource","group" = "GroupSource"})
|
||||||
*/
|
*/
|
||||||
abstract class AbstractSource extends AbstractEntity implements SourceInterface
|
abstract class AbstractSource extends AbstractEntity implements SourceInterface
|
||||||
{
|
{
|
||||||
use NodeAttribut;
|
use RelationAttribut,GroupSourcesAttribut;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var NodeInterface
|
* @var RelationInterface
|
||||||
* @ORM\OneToOne(targetEntity="App\Entity\Node",cascade={"persist", "remove"})
|
* @ORM\OneToOne(targetEntity="App\Entity\Relation",cascade={"persist", "remove"})
|
||||||
* @ORM\JoinColumn(name="node_id", referencedColumnName="id")
|
* @ORM\JoinColumn(name="relation_id", referencedColumnName="id")
|
||||||
* @Exclude
|
* @Exclude
|
||||||
*/
|
*/
|
||||||
protected $node;
|
protected $relation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Collection|GroupSource[]
|
||||||
|
* @ORM\ManyToMany(targetEntity="GroupSource")
|
||||||
|
*/
|
||||||
|
protected $groups;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->node = new Node();
|
$this->relation = new Relation();
|
||||||
$this->node->setSource($this);
|
$this->relation->setSource($this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Entity\Source\Attribut;
|
||||||
|
|
||||||
|
use Doctrine\Common\Collections\Collection;
|
||||||
|
use App\Entity\Source\GroupSourceInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author kevinfrantz
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
trait GroupSourcesAttribut
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @var Collection|GroupSourceInterface[]
|
||||||
|
*/
|
||||||
|
protected $groups;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return Collection|GroupSourceInterface[]
|
||||||
|
*/
|
||||||
|
public function getGroupSources():Collection{
|
||||||
|
return $this->groups;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param Collection|GroupSourceInterface[] $groups
|
||||||
|
*/
|
||||||
|
public function setGroupSources(Collection $groups):void{
|
||||||
|
$this->groups = $groups;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Entity\Source\Attribut;
|
||||||
|
|
||||||
|
use Doctrine\Common\Collections\Collection;
|
||||||
|
use App\Entity\Source\GroupSourceInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author kevinfrantz
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
interface GroupSourcesAttributInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param Collection|GroupSourceInterface[] $groups
|
||||||
|
*/
|
||||||
|
public function setGroupSources(Collection $groups):void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection|GroupSourceInterface[]
|
||||||
|
*/
|
||||||
|
public function getGroupSources():Collection;
|
||||||
|
}
|
||||||
|
|
30
application/src/Entity/Source/Attribut/MembersAttribut.php
Normal file
30
application/src/Entity/Source/Attribut/MembersAttribut.php
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Entity\Source\Attribut;
|
||||||
|
|
||||||
|
use Doctrine\Common\Collections\Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author kevinfrantz
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
trait MembersAttribut
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @var Collection
|
||||||
|
*/
|
||||||
|
protected $members;
|
||||||
|
|
||||||
|
public function getMembers(): Collection
|
||||||
|
{
|
||||||
|
return $this->members;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setMembers(Collection $members): void
|
||||||
|
{
|
||||||
|
$this->members = $members;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -9,17 +9,16 @@ use Doctrine\Common\Collections\Collection;
|
|||||||
* @author kevinfrantz
|
* @author kevinfrantz
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
interface SourcesAttributInterface
|
interface MembersAttributInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Collection $members
|
* @param Collection $members
|
||||||
*/
|
*/
|
||||||
public function setSources(Collection $sources): void;
|
public function setMembers(Collection $members): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Collection
|
* @return Collection
|
||||||
*/
|
*/
|
||||||
public function getSources(): Collection;
|
public function getMembers(): Collection;
|
||||||
}
|
}
|
||||||
|
|
@ -1,30 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace App\Entity\Source\Attribut;
|
|
||||||
|
|
||||||
use Doctrine\Common\Collections\Collection;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author kevinfrantz
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
trait SourcesAttribut
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @var Collection
|
|
||||||
*/
|
|
||||||
protected $sources;
|
|
||||||
|
|
||||||
public function getSources(): Collection
|
|
||||||
{
|
|
||||||
return $this->sources;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setSources(Collection $sources): void
|
|
||||||
{
|
|
||||||
$this->sources = $sources;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -3,8 +3,8 @@ namespace App\Entity\Source;
|
|||||||
|
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
use Doctrine\Common\Collections\Collection;
|
use Doctrine\Common\Collections\Collection;
|
||||||
use App\Entity\Attribut\SourceAttribut;
|
use App\Entity\Source\Attribut\MembersAttributInterface;
|
||||||
use App\Entity\Source\Attribut\SourcesAttribut;
|
use App\Entity\Source\Attribut\MembersAttribut;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -12,15 +12,15 @@ use App\Entity\Source\Attribut\SourcesAttribut;
|
|||||||
* @ORM\Table(name="source_sources")
|
* @ORM\Table(name="source_sources")
|
||||||
* @ORM\Entity
|
* @ORM\Entity
|
||||||
*/
|
*/
|
||||||
class SourcesSource extends AbstractSource implements SourcesSourceInterface
|
class GroupSource extends AbstractSource implements MembersAttributInterface
|
||||||
{
|
{
|
||||||
use SourcesAttribut;
|
use MembersAttribut;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var Collection
|
* @var Collection
|
||||||
* @ORM\ManyToMany(targetEntity="AbstractSource")
|
* @ORM\ManyToMany(targetEntity="AbstractSource")
|
||||||
*/
|
*/
|
||||||
protected $sources;
|
protected $members;
|
||||||
}
|
}
|
||||||
|
|
@ -1,15 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace App\Entity\Source;
|
namespace App\Entity\Source;
|
||||||
|
|
||||||
|
use App\Entity\Source\Attribut\MembersAttributInterface;
|
||||||
use App\Entity\Source\Attribut\SourcesAttributInterface;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author kevinfrantz
|
* @author kevinfrantz
|
||||||
* @todo Map the not jet mapped functions!
|
* @todo Map the not jet mapped functions!
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
interface SourcesSourceInterface extends SourcesAttributInterface
|
interface GroupSourceInterface extends MembersAttributInterface
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
@ -1,14 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace App\Entity\Source;
|
namespace App\Entity\Source;
|
||||||
|
|
||||||
use App\Entity\Attribut\NodeAttributInterface;
|
|
||||||
use App\Entity\Attribut\IdAttributInterface;
|
use App\Entity\Attribut\IdAttributInterface;
|
||||||
use App\Entity\EntityInterface;
|
use App\Entity\EntityInterface;
|
||||||
|
use App\Entity\Source\Attribut\GroupSourcesAttributInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author kevinfrantz
|
* @author kevinfrantz
|
||||||
*/
|
*/
|
||||||
interface SourceInterface extends IdAttributInterface, NodeAttributInterface, EntityInterface
|
interface SourceInterface extends IdAttributInterface, EntityInterface, GroupSourcesAttributInterface
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,12 @@
|
|||||||
namespace App\Structur\Facade\Security\Source;
|
namespace App\Structur\Facade\Security\Source;
|
||||||
|
|
||||||
use App\Entity\Source\NameSourceInterface;
|
use App\Entity\Source\NameSourceInterface;
|
||||||
|
use App\Entity\Source\SourceInterface;
|
||||||
use App\Entity\UserInterface;
|
use App\Entity\UserInterface;
|
||||||
use App\Entity\Source\UserSourceInterface;
|
use App\Entity\Source\UserSourceInterface;
|
||||||
use App\DBAL\Types\RightType;
|
use App\DBAL\Types\RightType;
|
||||||
use App\DBAL\Types\LayerType;
|
use App\DBAL\Types\LayerType;
|
||||||
|
use Doctrine\Common\Collections\Collection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -62,4 +64,36 @@ class UserSourceFacade extends AbstractSourceFacade implements UserSourceInterfa
|
|||||||
* @todo Implement
|
* @todo Implement
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setSource(SourceInterface $source): void
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @todo Implement
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getGroupSources(): Collection
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @todo Implement
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSource(): SourceInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @todo Implement
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setGroupSources(Collection $groups): void
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @todo Implement
|
||||||
|
*/
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user