infinito/application/src/Entity/Right.php

56 lines
1.4 KiB
PHP
Raw Normal View History

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-14 00:18:21 +02:00
use App\Entity\Attribut\PermissionsAttribut;
use Doctrine\Common\Collections\Collection;
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-14 00:18:21 +02:00
use TypeAttribut,LawAttribut,PermissionsAttribut;
2018-09-13 16:51:58 +02:00
2018-09-13 16:37:33 +02:00
/**
* @ORM\ManyToOne(targetEntity="Law", inversedBy="rights")
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
/**
* @ORM\OneToMany(targetEntity="Permission", mappedBy="right", cascade={"persist", "remove"})
2018-09-13 16:51:58 +02:00
*
* @var Collection
2018-09-13 16:51:58 +02:00
*/
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
}