src/Entity/Security/Permission.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Security;
  3. use App\Entity\Menu;
  4. use App\Repository\Security\PermissionRepository;
  5. use Doctrine\ORM\Mapping as ORM;
  6. /**
  7.  * @ORM\Entity(repositoryClass=PermissionRepository::class)
  8.  */
  9. class Permission
  10. {
  11.     const EDIT 'edit';
  12.     const DELETE 'delete';
  13.     const SHOW 'show';
  14.     const LIST = 'list';
  15.     const NEW = 'new';
  16.     /**
  17.      * @ORM\Id
  18.      * @ORM\GeneratedValue
  19.      * @ORM\Column(type="integer")
  20.      */
  21.     private $id;
  22.     /**
  23.      * @ORM\ManyToOne(targetEntity=Menu::class, inversedBy="permissions", fetch="EAGER")
  24.      * @ORM\JoinColumn(nullable=false)
  25.      */
  26.     private $menu;
  27.     /**
  28.      * @ORM\ManyToOne(targetEntity=Profile::class, inversedBy="permissions")
  29.      * @ORM\JoinColumn(nullable=false)
  30.      */
  31.     private $profile;
  32.     /**
  33.      * @ORM\Column(type="array", nullable=true)
  34.      */
  35.     private $actions = [];
  36.     public function getId(): ?int
  37.     {
  38.         return $this->id;
  39.     }
  40.     public function getMenu(): ?Menu
  41.     {
  42.         return $this->menu;
  43.     }
  44.     public function setMenu(?Menu $menu): self
  45.     {
  46.         $this->menu $menu;
  47.         return $this;
  48.     }
  49.     public function getProfile(): ?Profile
  50.     {
  51.         return $this->profile;
  52.     }
  53.     public function setProfile(?Profile $profile): self
  54.     {
  55.         $this->profile $profile;
  56.         return $this;
  57.     }
  58.     public function getActions(): ?array
  59.     {
  60.         return $this->actions;
  61.     }
  62.     public function setActions(?array $actions): self
  63.     {
  64.         $this->actions $actions;
  65.         return $this;
  66.     }
  67.     public function __toString(): string
  68.     {
  69.         return implode(', '$this->getActions());
  70.     }
  71. }