src/Entity/Page.php line 13

  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use App\Repository\PageRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ORM\Entity(repositoryClassPageRepository::class)]
  9. #[ApiResource]
  10. class Page
  11. {
  12.     #[ORM\Id]
  13.     #[ORM\GeneratedValue]
  14.     #[ORM\Column]
  15.     private ?int $id null;
  16.     #[ORM\Column(length255)]
  17.     private ?string $nom null;
  18.     #[ORM\Column(length255)]
  19.     private ?string $url null;
  20.     #[ORM\Column(length255nullabletrue)]
  21.     private ?string $icon null;
  22.     #[ORM\Column]
  23.     private ?int $position null;
  24.     #[ORM\Column]
  25.     private ?int $num_menu null;
  26.     #[ORM\OneToMany(mappedBy'page'targetEntityProfilDroitPage::class, orphanRemovaltrue)]
  27.     private Collection $profilDroitPages;
  28.     public function __construct()
  29.     {
  30.         $this->profilDroitPages = new ArrayCollection();
  31.     }
  32.     public function getId(): ?int
  33.     {
  34.         return $this->id;
  35.     }
  36.     public function getNom(): ?string
  37.     {
  38.         return $this->nom;
  39.     }
  40.     public function setNom(string $nom): static
  41.     {
  42.         $this->nom $nom;
  43.         return $this;
  44.     }
  45.     public function getUrl(): ?string
  46.     {
  47.         return $this->url;
  48.     }
  49.     public function setUrl(string $url): static
  50.     {
  51.         $this->url $url;
  52.         return $this;
  53.     }
  54.     public function getIcon(): ?string
  55.     {
  56.         return $this->icon;
  57.     }
  58.     public function setIcon(?string $icon): static
  59.     {
  60.         $this->icon $icon;
  61.         return $this;
  62.     }
  63.     public function getPosition(): ?int
  64.     {
  65.         return $this->position;
  66.     }
  67.     public function setPosition(int $position): static
  68.     {
  69.         $this->position $position;
  70.         return $this;
  71.     }
  72.     public function getNumMenu(): ?int
  73.     {
  74.         return $this->num_menu;
  75.     }
  76.     public function setNumMenu(int $num_menu): static
  77.     {
  78.         $this->num_menu $num_menu;
  79.         return $this;
  80.     }
  81.     /**
  82.      * @return Collection<int, ProfilDroitPage>
  83.      */
  84.     public function getProfilDroitPages(): Collection
  85.     {
  86.         return $this->profilDroitPages;
  87.     }
  88.     public function addProfilDroitPage(ProfilDroitPage $profilDroitPage): static
  89.     {
  90.         if (!$this->profilDroitPages->contains($profilDroitPage)) {
  91.             $this->profilDroitPages->add($profilDroitPage);
  92.             $profilDroitPage->setPage($this);
  93.         }
  94.         return $this;
  95.     }
  96.     public function removeProfilDroitPage(ProfilDroitPage $profilDroitPage): static
  97.     {
  98.         if ($this->profilDroitPages->removeElement($profilDroitPage)) {
  99.             // set the owning side to null (unless already changed)
  100.             if ($profilDroitPage->getPage() === $this) {
  101.                 $profilDroitPage->setPage(null);
  102.             }
  103.         }
  104.         return $this;
  105.     }
  106. }