Implemented Permission draft

This commit is contained in:
Kevin Frantz
2018-09-13 16:51:58 +02:00
parent 92886a14ce
commit 69f2beac72
28 changed files with 203 additions and 143 deletions

View File

@@ -1,4 +1,5 @@
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
@@ -8,7 +9,6 @@ use App\DBAL\Types\RightType;
use App\Entity\Attribut\NodeAttribut;
/**
*
* @author kevinfrantz
* @ORM\Table(name="law")
* @ORM\Entity(repositoryClass="App\Repository\LawRepository")
@@ -18,8 +18,8 @@ class Law extends AbstractEntity implements LawInterface
use RightsAttribute, NodeAttribut;
/**
*
* @ORM\OneToMany(targetEntity="Right", mappedBy="id", cascade={"persist", "remove"})
*
* @var ArrayCollection
*/
protected $rights;
@@ -27,10 +27,11 @@ class Law extends AbstractEntity implements LawInterface
/**
* @ORM\OneToOne(targetEntity="Node",cascade={"persist", "remove"})
* @ORM\JoinColumn(name="node_id", referencedColumnName="id")
*
* @var NodeInterface
*/
protected $node;
public function __construct()
{
$this->initAllRights();
@@ -39,13 +40,11 @@ class Law extends AbstractEntity implements LawInterface
private function initAllRights(): void
{
$this->rights = new ArrayCollection();
foreach (RightType::getChoices() as $key=>$value){
foreach (RightType::getChoices() as $key => $value) {
$right = new Right();
$right->setType($value);
$right->setLaw($this);
$this->rights->set($key, $right);
}
}
}