mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-09-16 23:26:04 +02:00
Optimized creation process
This commit is contained in:
@@ -5,9 +5,7 @@ namespace App\Entity;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use App\Entity\Attribut\RightsAttribute;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use App\DBAL\Types\RightType;
|
||||
use App\Entity\Attribut\NodeAttribut;
|
||||
use App\DBAL\Types\LayerType;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
@@ -41,20 +39,12 @@ class Law extends AbstractEntity implements LawInterface
|
||||
private function initAllRights(): void
|
||||
{
|
||||
$this->rights = new ArrayCollection();
|
||||
foreach (LayerType::getChoices() as $layerKey => $layerValue) {
|
||||
foreach (RightType::getChoices() as $rightKey => $rightValue) {
|
||||
$right = new Right();
|
||||
$right->setType($rightKey);
|
||||
$right->setLaw($this);
|
||||
$right->setLayer($layerKey);
|
||||
$this->rights->add($right);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function isGranted(NodeInterface $node, string $layer, string $right): bool
|
||||
{
|
||||
/**
|
||||
/*
|
||||
*
|
||||
* @var RightInterface
|
||||
*/
|
||||
foreach ($this->rights->toArray() as $right) {
|
||||
|
Reference in New Issue
Block a user