mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-09-13 21:57:16 +02:00
Optimized law draft
This commit is contained in:
@@ -1,15 +1,42 @@
|
||||
<?php
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Entity\Attribut\NodeAttribut;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Entity\Attribut\RightsAttribute;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use App\DBAL\Types\RightType;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*
|
||||
* @ORM\Table(name="law")
|
||||
* @ORM\Entity(repositoryClass="App\Repository\LawRepository")
|
||||
*/
|
||||
class Law implements LawInterface
|
||||
class Law extends AbstractEntity implements LawInterface
|
||||
{
|
||||
use NodeAttribut;
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user