src/Entity/Role.php line 13
<?phpnamespace App\Entity;use App\Repository\RoleRepository;use App\Traits\TimeStampTrait;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: RoleRepository::class)]#[ORM\HasLifecycleCallbacks]class Role{use TimeStampTrait;#[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(nullable: true)]private ?bool $status = null;#[ORM\Column(length: 255, nullable: true)]private ?string $description = null;#[ORM\ManyToMany(targetEntity: Privilege::class, inversedBy: 'roles')]private Collection $privilege;#[ORM\OneToMany(mappedBy: 'role', targetEntity: User::class)]private Collection $users;#[ORM\ManyToOne(inversedBy: 'roles')]private ?Entreprise $marchand = null;public function __construct(){$this->privilege = new ArrayCollection();$this->users = 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 isStatus(): ?bool{return $this->status;}public function setStatus(?bool $status): self{$this->status = $status;return $this;}public function getDescription(): ?string{return $this->description;}public function setDescription(?string $description): self{$this->description = $description;return $this;}/*** @return Collection<int, Privilege>*/public function getPrivilege(): Collection{return $this->privilege;}public function addPrivilege(Privilege $privilege): self{if (!$this->privilege->contains($privilege)) {$this->privilege->add($privilege);}return $this;}public function removePrivilege(Privilege $privilege): self{$this->privilege->removeElement($privilege);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->add($user);$user->setRole($this);}return $this;}public function removeUser(User $user): self{if ($this->users->removeElement($user)) {// set the owning side to null (unless already changed)if ($user->getRole() === $this) {$user->setRole(null);}}return $this;}public function __toString(): string{return $this->name;}public function getMarchand(): ?Entreprise{return $this->marchand;}public function setMarchand(?Entreprise $marchand): static{$this->marchand = $marchand;return $this;}}