Updated registration process

This commit is contained in:
Kevin Frantz
2018-09-21 19:43:48 +02:00
parent fcfe1ce9d7
commit f919b0e02c
8 changed files with 45 additions and 36 deletions

View File

@@ -7,6 +7,10 @@ use App\DBAL\Types\RightType;
use App\Entity\NodeInterface;
use App\Entity\Right;
use App\Entity\LawInterface;
use App\DBAL\Types\RecieverType;
use App\Entity\RightInterface;
use App\Entity\RecieverGroupInterface;
use App\Entity\RecieverGroup;
/**
* @author kevinfrantz
@@ -17,13 +21,30 @@ abstract class LawModificator
{
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);
$right = self::createRight($law, $node, $rightKey, $layerKey);
$right->setRecieverGroup(self::createRecieverGroup($node, RecieverType::NODE));
$law->getRights()->add($right);
}
}
}
public static function createRight(LawInterface $law, NodeInterface $node, string $type, string $layer): RightInterface
{
$right = new Right();
$right->setType($type);
$right->setLaw($law);
$right->setLayer($layer);
$right->setNode($node);
return $right;
}
public static function createRecieverGroup(NodeInterface $node, string $reciever): RecieverGroupInterface
{
$recieverGroup = new RecieverGroup();
$recieverGroup->setNode($node);
$recieverGroup->setReciever($reciever);
return $recieverGroup;
}
}