src/Entity/PageType.php line 12

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\PageTypeRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ORM\Entity(repositoryClassPageTypeRepository::class)]
  9. class PageType
  10. {
  11.     const ABOUT 'AB';
  12.     const MEDIA 'MD';
  13.     const NEWS 'NW';
  14.     #[ORM\Id]
  15.     #[ORM\GeneratedValue]
  16.     #[ORM\Column(length2)]
  17.     private ?string $pageTypeCode null;
  18.     #[ORM\Column(length255)]
  19.     private ?string $name null;
  20.     #[ORM\Column(typeTypes::DATETIME_MUTABLE)]
  21.     private ?\DateTimeInterface $updated null;
  22.     #[ORM\Column]
  23.     private ?int $updatedBy null;
  24.     #[ORM\OneToMany(mappedBy'pageTypeCode'targetEntityPage::class)]
  25.     #@ORM\JoinColumn(name="page_type_code", referencedColumnName="page_type_code")
  26.     private Collection $pages;
  27.     public function __construct()
  28.     {
  29.         $this->pages = new ArrayCollection();
  30.     }
  31.     public function getPageTypeCode(): ?string
  32.     {
  33.         return $this->pageTypeCode;
  34.     }
  35.     public function setPageTypeCode(string $pageTypeCode): self
  36.     {
  37.         $this->pageTypeCode $pageTypeCode;
  38.         return $this;
  39.     }
  40.     public function getName(): ?string
  41.     {
  42.         return $this->name;
  43.     }
  44.     public function setName(string $name): self
  45.     {
  46.         $this->name $name;
  47.         return $this;
  48.     }
  49.     public function getUpdated(): ?\DateTimeInterface
  50.     {
  51.         return $this->updated;
  52.     }
  53.     public function setUpdated(\DateTimeInterface $updated): self
  54.     {
  55.         $this->updated $updated;
  56.         return $this;
  57.     }
  58.     public function getUpdatedBy(): ?int
  59.     {
  60.         return $this->updatedBy;
  61.     }
  62.     public function setUpdatedBy(int $updatedBy): self
  63.     {
  64.         $this->updatedBy $updatedBy;
  65.         return $this;
  66.     }
  67.     /**
  68.      * @return Collection<int, Page>
  69.      */
  70.     public function getPages(): Collection
  71.     {
  72.         return $this->pages;
  73.     }
  74.     public function addPage(Page $page): self
  75.     {
  76.         if (!$this->pages->contains($page)) {
  77.             $this->pages->add($page);
  78.             $page->setPageTypeCode($this);
  79.         }
  80.         return $this;
  81.     }
  82.     public function removePage(Page $page): self
  83.     {
  84.         if ($this->pages->removeElement($page)) {
  85.             // set the owning side to null (unless already changed)
  86.             if ($page->getPageTypeCode() === $this) {
  87.                 $page->setPageTypeCode(null);
  88.             }
  89.         }
  90.         return $this;
  91.     }
  92. }