src/Entity/Privilege.php line 14
<?phpnamespace App\Entity;use App\Repository\PrivilegeRepository;use App\Traits\TimeStampTrait;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;#[ORM\HasLifecycleCallbacks]#[ORM\Entity(repositoryClass: PrivilegeRepository::class)]class Privilege{#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;#[ORM\Column(length: 50)]private ?string $code = null;#[ORM\Column(length: 50, nullable: true)]private ?string $name = null;#[ORM\Column(length: 50, nullable: true)]private ?string $libelle = null;#[ORM\ManyToMany(targetEntity: Role::class, mappedBy: 'privilege')]private Collection $roles;public function __construct(){$this->roles = new ArrayCollection();}public function getId(): ?int{return $this->id;}public function getCode(): ?string{return $this->code;}public function setCode(string $code): self{$this->code = $code;return $this;}public function getName(): ?string{return $this->name;}public function setName(?string $name): self{$this->name = $name;return $this;}public function getLibelle(): ?string{return $this->libelle;}public function setLibelle(?string $libelle): self{$this->libelle = $libelle;return $this;}/*** @return Collection<int, Role>*/public function getRoles(): Collection{return $this->roles;}public function addRole(Role $role): self{if (!$this->roles->contains($role)) {$this->roles->add($role);$role->addPrivilege($this);}return $this;}public function removeRole(Role $role): self{if ($this->roles->removeElement($role)) {$role->removePrivilege($this);}return $this;}public function __toString(): string{return $this->name;}}