src/Entity/Page/PageType.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Page;
  3. use App\Entity\Page\Page;
  4. use App\Repository\Page\PageTypeRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\DBAL\Types\Types;
  8. use Doctrine\ORM\Mapping as ORM;
  9. #[ORM\Entity(repositoryClassPageTypeRepository::class)]
  10. class PageType
  11. {
  12.     #[ORM\Id]
  13.     #[ORM\GeneratedValue]
  14.     #[ORM\Column]
  15.     private ?int $id null;
  16.     #[ORM\Column(length255)]
  17.     private ?string $slug null;
  18.     #[ORM\Column(length255)]
  19.     private ?string $label null;
  20.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  21.     private ?string $description null;
  22.     #[ORM\Column(nullabletrue)]
  23.     private ?bool $isSystem null;
  24.     #[ORM\OneToMany(mappedBy'pageType'targetEntityPage::class)]
  25.     private Collection $pages;
  26.     public function __toString()
  27.     {
  28.         return $this->label;
  29.     }
  30.     public function __construct()
  31.     {
  32.         $this->pages = new ArrayCollection();
  33.     }
  34.     public function getId(): ?int
  35.     {
  36.         return $this->id;
  37.     }
  38.     public function getSlug(): ?string
  39.     {
  40.         return $this->slug;
  41.     }
  42.     public function setSlug(string $slug): static
  43.     {
  44.         $this->slug $slug;
  45.         return $this;
  46.     }
  47.     public function getLabel(): ?string
  48.     {
  49.         return $this->label;
  50.     }
  51.     public function setLabel(string $label): static
  52.     {
  53.         $this->label $label;
  54.         return $this;
  55.     }
  56.     public function getDescription(): ?string
  57.     {
  58.         return $this->description;
  59.     }
  60.     public function setDescription(?string $description): static
  61.     {
  62.         $this->description $description;
  63.         return $this;
  64.     }
  65.     public function isIsSystem(): ?bool
  66.     {
  67.         return $this->isSystem;
  68.     }
  69.     public function setIsSystem(?bool $isSystem): static
  70.     {
  71.         $this->isSystem $isSystem;
  72.         return $this;
  73.     }
  74.     /**
  75.      * @return Collection<int, Page>
  76.      */
  77.     public function getPages(): Collection
  78.     {
  79.         return $this->pages;
  80.     }
  81.     public function addPage(Page $page): static
  82.     {
  83.         if (!$this->pages->contains($page)) {
  84.             $this->pages->add($page);
  85.             $page->setPageType($this);
  86.         }
  87.         return $this;
  88.     }
  89.     public function removePage(Page $page): static
  90.     {
  91.         if ($this->pages->removeElement($page)) {
  92.             // set the owning side to null (unless already changed)
  93.             if ($page->getPageType() === $this) {
  94.                 $page->setPageType(null);
  95.             }
  96.         }
  97.         return $this;
  98.     }
  99. }