src/Entity/Right.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\RightRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=RightRepository::class)
  9.  * @ORM\Table(name="`right`")
  10.  */
  11. class Right
  12. {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @ORM\Column(type="string", length=255)
  21.      */
  22.     private $name;
  23.     /**
  24.      * @ORM\Column(type="string", length=255)
  25.      */
  26.     private $code;
  27.     /**
  28.      * @ORM\Column(type="string", length=50, nullable=true)
  29.      */
  30.     private $moduleCode;
  31.     /**
  32.      * @ORM\Column(type="string", length=100, nullable=true)
  33.      */
  34.     private $moduleName;
  35.     /**
  36.      * @ORM\Column(type="text", nullable=true)
  37.      */
  38.     private $description;
  39.     /**
  40.      * @ORM\Column(name="module_order", type="integer", options={"default" : 0})
  41.      */
  42.     private $moduleOrder 0;
  43.     /**
  44.      * @ORM\ManyToMany(targetEntity=GroupUser::class, inversedBy="rights")
  45.      */
  46.     private $groups;
  47.     public function __construct()
  48.     {
  49.         $this->groups = new ArrayCollection();
  50.     }
  51.     // --- Getters & Setters ---
  52.     public function getId(): ?int
  53.     {
  54.         return $this->id;
  55.     }
  56.     public function getName(): ?string
  57.     {
  58.         return $this->name;
  59.     }
  60.     public function setName(string $name): self
  61.     {
  62.         $this->name $name;
  63.         return $this;
  64.     }
  65.     public function getCode(): ?string
  66.     {
  67.         return $this->code;
  68.     }
  69.     public function setCode(string $code): self
  70.     {
  71.         $this->code $code;
  72.         return $this;
  73.     }
  74.     public function getModuleCode(): ?string
  75.     {
  76.         return $this->moduleCode;
  77.     }
  78.     public function setModuleCode(?string $moduleCode): self
  79.     {
  80.         $this->moduleCode $moduleCode;
  81.         return $this;
  82.     }
  83.     public function getModuleName(): ?string
  84.     {
  85.         return $this->moduleName;
  86.     }
  87.     public function setModuleName(?string $moduleName): self
  88.     {
  89.         $this->moduleName $moduleName;
  90.         return $this;
  91.     }
  92.     public function getDescription(): ?string
  93.     {
  94.         return $this->description;
  95.     }
  96.     public function setDescription(?string $description): self
  97.     {
  98.         $this->description $description;
  99.         return $this;
  100.     }
  101.     public function getModuleOrder(): int
  102.     {
  103.         return $this->moduleOrder;
  104.     }
  105.     public function setModuleOrder(int $moduleOrder): self
  106.     {
  107.         $this->moduleOrder $moduleOrder;
  108.         return $this;
  109.     }
  110.     /**
  111.      * @return Collection|GroupUser[]
  112.      */
  113.     public function getGroups(): Collection
  114.     {
  115.         return $this->groups;
  116.     }
  117.     public function addGroup(GroupUser $group): self
  118.     {
  119.         if (!$this->groups->contains($group)) {
  120.             $this->groups[] = $group;
  121.         }
  122.         return $this;
  123.     }
  124.     public function removeGroup(GroupUser $group): self
  125.     {
  126.         $this->groups->removeElement($group);
  127.         return $this;
  128.     }
  129. }