<?phpnamespace App\Entity;use App\Repository\GroupePermissionRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Doctrine\DBAL\Types\Types;#[ORM\Entity(repositoryClass: GroupePermissionRepository::class)]class GroupePermission{ #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column(type: 'integer')] private $id; #[ORM\Column(type: 'string', length: 255)] private $libelle; #[ORM\Column(type: Types::TEXT, length:10000, nullable:true)] private $description; #[ORM\ManyToMany(targetEntity: User::class, mappedBy: 'group_permission')] private $users; #[ORM\ManyToMany(targetEntity: Permission::class, inversedBy: 'groupePermissions')] private $permission; public function __construct() { $this->users = new ArrayCollection(); $this->permission = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getLibelle(): ?string { return $this->libelle; } public function setLibelle(string $libelle): self { $this->libelle = $libelle; return $this; } public function getDescription(): ?string { return $this->description; } public function setDescription(string $description): self { $this->description = $description; return $this; } /** * @return Collection<int, User> */ public function getUsers(): Collection { return $this->users; } public function addUser(User $user): self { if (!$this->users->contains($user)) { $this->users[] = $user; $user->addGroupPermission($this); } return $this; } public function removeUser(User $user): self { if ($this->users->removeElement($user)) { $user->removeGroupPermission($this); } return $this; } /** * @return Collection<int, Permission> */ public function getPermission(): Collection { return $this->permission; } public function addPermission(Permission $permission): self { if (!$this->permission->contains($permission)) { $this->permission[] = $permission; } return $this; } public function removePermission(Permission $permission): self { $this->permission->removeElement($permission); return $this; } public function __toString() { return $this->libelle; }}