2018-09-13 14:39:03 +02:00
|
|
|
<?php
|
|
|
|
namespace App\Entity;
|
|
|
|
|
2018-09-13 15:55:48 +02:00
|
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
|
use Entity\Attribut\RightsAttribute;
|
|
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
|
|
use App\DBAL\Types\RightType;
|
2018-09-13 14:39:03 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @author kevinfrantz
|
2018-09-13 15:55:48 +02:00
|
|
|
* @ORM\Table(name="law")
|
|
|
|
* @ORM\Entity(repositoryClass="App\Repository\LawRepository")
|
2018-09-13 14:39:03 +02:00
|
|
|
*/
|
2018-09-13 15:55:48 +02:00
|
|
|
class Law extends AbstractEntity implements LawInterface
|
2018-09-13 14:39:03 +02:00
|
|
|
{
|
2018-09-13 15:55:48 +02:00
|
|
|
use RightsAttribute;
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @ORM\OneToMany(targetEntity="Right", mappedBy="id", cascade={"persist", "remove"})
|
|
|
|
* @var ArrayCollection
|
|
|
|
*/
|
|
|
|
protected $rights;
|
|
|
|
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
parent::__contruct();
|
|
|
|
$this->initAllRights();
|
|
|
|
}
|
|
|
|
|
|
|
|
private function initAllRights(): void
|
|
|
|
{
|
|
|
|
foreach (RightType::getChoices() as $key=>$value){
|
|
|
|
$right = new Right();
|
|
|
|
$right->setType($value);
|
|
|
|
$this->rights->set($key, $right);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-09-13 14:39:03 +02:00
|
|
|
}
|
|
|
|
|