src/Entity/GroupePermission.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\GroupePermissionRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Doctrine\DBAL\Types\Types;
  8. #[ORM\Entity(repositoryClassGroupePermissionRepository::class)]
  9. class GroupePermission
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column(type'integer')]
  14.     private $id;
  15.     #[ORM\Column(type'string'length255)]
  16.     private $libelle;
  17.     #[ORM\Column(typeTypes::TEXTlength:10000nullable:true)]
  18.     private $description;
  19.     #[ORM\ManyToMany(targetEntityUser::class, mappedBy'group_permission')]
  20.     private $users;
  21.     #[ORM\ManyToMany(targetEntityPermission::class, inversedBy'groupePermissions')]
  22.     private $permission;
  23.     public function __construct()
  24.     {
  25.         $this->users = new ArrayCollection();
  26.         $this->permission = new ArrayCollection();
  27.     }
  28.     public function getId(): ?int
  29.     {
  30.         return $this->id;
  31.     }
  32.     public function getLibelle(): ?string
  33.     {
  34.         return $this->libelle;
  35.     }
  36.     public function setLibelle(string $libelle): self
  37.     {
  38.         $this->libelle $libelle;
  39.         return $this;
  40.     }
  41.     public function getDescription(): ?string
  42.     {
  43.         return $this->description;
  44.     }
  45.     public function setDescription(string $description): self
  46.     {
  47.         $this->description $description;
  48.         return $this;
  49.     }
  50.     /**
  51.      * @return Collection<int, User>
  52.      */
  53.     public function getUsers(): Collection
  54.     {
  55.         return $this->users;
  56.     }
  57.     public function addUser(User $user): self
  58.     {
  59.         if (!$this->users->contains($user)) {
  60.             $this->users[] = $user;
  61.             $user->addGroupPermission($this);
  62.         }
  63.         return $this;
  64.     }
  65.     public function removeUser(User $user): self
  66.     {
  67.         if ($this->users->removeElement($user)) {
  68.             $user->removeGroupPermission($this);
  69.         }
  70.         return $this;
  71.     }
  72.     /**
  73.      * @return Collection<int, Permission>
  74.      */
  75.     public function getPermission(): Collection
  76.     {
  77.         return $this->permission;
  78.     }
  79.     public function addPermission(Permission $permission): self
  80.     {
  81.         if (!$this->permission->contains($permission)) {
  82.             $this->permission[] = $permission;
  83.         }
  84.         return $this;
  85.     }
  86.     public function removePermission(Permission $permission): self
  87.     {
  88.         $this->permission->removeElement($permission);
  89.         return $this;
  90.     }
  91.     public function __toString()
  92.     {
  93.         return $this->libelle;
  94.     }
  95. }