Optimized creation process

This commit is contained in:
Kevin Frantz
2018-09-21 16:27:49 +02:00
parent 54615a458e
commit 7c85b98df6
4 changed files with 34 additions and 13 deletions

View File

@@ -0,0 +1,29 @@
<?php
namespace App\Creator\Modificator\Entity;
use App\DBAL\Types\LayerType;
use App\DBAL\Types\RightType;
use App\Entity\NodeInterface;
use App\Entity\Right;
use App\Entity\LawInterface;
/**
* @author kevinfrantz
*/
abstract class LawModificator
{
public static function grantAllRights(LawInterface $law, NodeInterface $node): void
{
foreach (LayerType::getChoices() as $layerKey => $layerValue) {
foreach (RightType::getChoices() as $rightKey => $rightValue) {
$right = new Right();
$right->setType($rightKey);
$right->setLaw($this);
$right->setLayer($layerKey);
$right->setNode($node);
$law->getRights()->add($right);
}
}
}
}