src/Entity/Role.php line 16
<?phpnamespace App\Entity;use ApiPlatform\Metadata\ApiResource;use App\Repository\RoleRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Serializer\Annotation\Groups;#[ORM\Entity(repositoryClass: RoleRepository::class)]#[ApiResource(normalizationContext: ['groups' => ['role']])]class Role{#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]#[Groups("role")]private ?int $id = null;#[ORM\Column(length: 255)]#[Groups("role")]private ?string $nom = null;#[ORM\Column(length: 255)]#[Groups("role")]private ?string $code = null;#[ORM\OneToMany(mappedBy: 'role', targetEntity: ProfilDroitPage::class, orphanRemoval: true)]#[Groups("role")]private Collection $profilDroitPages;public function __construct(){$this->profilDroitPages = new ArrayCollection();}public function getId(): ?int{return $this->id;}public function getNom(): ?string{return $this->nom;}public function setNom(string $nom): static{$this->nom = $nom;return $this;}public function getCode(): ?string{return $this->code;}public function setCode(string $code): static{$this->code = $code;return $this;}/*** @return Collection<int, ProfilDroitPage>*/public function getProfilDroitPages(): Collection{return $this->profilDroitPages;}public function addProfilDroitPage(ProfilDroitPage $profilDroitPage): static{if (!$this->profilDroitPages->contains($profilDroitPage)) {$this->profilDroitPages->add($profilDroitPage);$profilDroitPage->setRole($this);}return $this;}public function removeProfilDroitPage(ProfilDroitPage $profilDroitPage): static{if ($this->profilDroitPages->removeElement($profilDroitPage)) {// set the owning side to null (unless already changed)if ($profilDroitPage->getRole() === $this) {$profilDroitPage->setRole(null);}}return $this;}}