src/Entity/Right.php line 14

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\ManyToMany(targetEntity=GroupUser::class, inversedBy="rights")
  29.      */
  30.     private $groups;
  31.     public function __construct()
  32.     {
  33.         $this->groups = new ArrayCollection();
  34.     }
  35.     public function getId(): ?int
  36.     {
  37.         return $this->id;
  38.     }
  39.     public function getName(): ?string
  40.     {
  41.         return $this->name;
  42.     }
  43.     public function setName(string $name): self
  44.     {
  45.         $this->name $name;
  46.         return $this;
  47.     }
  48.     public function getCode(): ?string
  49.     {
  50.         return $this->code;
  51.     }
  52.     public function setCode(string $code): self
  53.     {
  54.         $this->code $code;
  55.         return $this;
  56.     }
  57.     /**
  58.      * @return Collection|GroupUser[]
  59.      */
  60.     public function getGroups(): Collection
  61.     {
  62.         return $this->groups;
  63.     }
  64.     public function addGroup(GroupUser $group): self
  65.     {
  66.         if (!$this->groups->contains($group)) {
  67.             $this->groups[] = $group;
  68.         }
  69.         return $this;
  70.     }
  71.     public function removeGroup(GroupUser $group): self
  72.     {
  73.         $this->groups->removeElement($group);
  74.         return $this;
  75.     }
  76. }