2018-09-13 15:55:48 +02:00
|
|
|
<?php
|
2018-09-13 16:51:58 +02:00
|
|
|
|
2018-09-13 15:55:48 +02:00
|
|
|
namespace App\Entity;
|
|
|
|
|
|
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
|
|
use App\Entity\Attribut\TypeAttribut;
|
|
|
|
use App\DBAL\Types\RightType;
|
|
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
|
use Fresh\DoctrineEnumBundle\Validator\Constraints as DoctrineAssert;
|
2018-09-13 16:37:33 +02:00
|
|
|
use App\Entity\Attribut\LawAttribut;
|
2018-09-13 22:35:32 +02:00
|
|
|
use App\Entity\Attribut\PermissionAttribut;
|
2018-09-13 15:55:48 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @author kevinfrantz
|
2018-09-13 16:37:33 +02:00
|
|
|
* @ORM\Table(name="`right`")
|
2018-09-13 15:55:48 +02:00
|
|
|
* @ORM\Entity(repositoryClass="App\Repository\RightRepository")
|
|
|
|
*/
|
|
|
|
class Right extends AbstractEntity implements RightInterface
|
|
|
|
{
|
2018-09-13 22:35:32 +02:00
|
|
|
use TypeAttribut,LawAttribut,PermissionAttribut;
|
2018-09-13 16:51:58 +02:00
|
|
|
|
2018-09-13 16:37:33 +02:00
|
|
|
/**
|
2018-09-13 22:35:32 +02:00
|
|
|
* @ORM\ManyToOne(targetEntity="Law")
|
2018-09-13 16:37:33 +02:00
|
|
|
* @ORM\JoinColumn(name="law_id", referencedColumnName="id")
|
2018-09-13 16:51:58 +02:00
|
|
|
*
|
2018-09-13 16:37:33 +02:00
|
|
|
* @var LawInterface
|
|
|
|
*/
|
|
|
|
protected $law;
|
2018-09-13 16:51:58 +02:00
|
|
|
|
2018-09-13 15:55:48 +02:00
|
|
|
/**
|
|
|
|
* @ORM\Column(name="type", type="RightType", nullable=false)
|
|
|
|
* @DoctrineAssert\Enum(entity="App\DBAL\Types\RightType")
|
2018-09-13 16:51:58 +02:00
|
|
|
*
|
2018-09-13 15:55:48 +02:00
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $type;
|
2018-09-13 16:51:58 +02:00
|
|
|
|
|
|
|
/**
|
2018-09-13 22:35:32 +02:00
|
|
|
* @ORM\OneToMany(targetEntity="Permission", mappedBy="id", cascade={"persist", "remove"})
|
2018-09-13 16:51:58 +02:00
|
|
|
*
|
|
|
|
* @var ArrayCollection
|
|
|
|
*/
|
|
|
|
protected $permissions;
|
|
|
|
|
2018-09-13 15:55:48 +02:00
|
|
|
public function isGranted(NodeInterface $node): bool
|
2018-09-13 16:51:58 +02:00
|
|
|
{
|
|
|
|
}
|
2018-09-13 15:55:48 +02:00
|
|
|
|
2018-09-13 22:35:32 +02:00
|
|
|
public function __construct()
|
2018-09-13 16:51:58 +02:00
|
|
|
{
|
2018-09-13 22:35:32 +02:00
|
|
|
parent::__construct();
|
|
|
|
$this->permissions = new ArrayCollection();
|
2018-09-13 16:51:58 +02:00
|
|
|
}
|
2018-09-13 15:55:48 +02:00
|
|
|
}
|