src/Entity/Page.php line 13

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\PageRepository;
  4. use DateTime;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Component\Serializer\Annotation\Groups;
  9. #[ORM\Entity(repositoryClassPageRepository::class)]
  10. class Page
  11. {
  12.     #[ORM\Id]
  13.     #[ORM\GeneratedValue]
  14.     #[ORM\Column(type'integer')]
  15.     private $id;
  16.     #[ORM\Column(type'string'length255nullabletrue)]
  17.     #[Groups(["main"])]
  18.     private $title;
  19.     #[ORM\Column(type'string'length255nullabletrue)]
  20.     private $image;
  21.     #[ORM\Column(type'text'nullabletrue)]
  22.     #[Groups(["main"])]
  23.     private $text;
  24.     #[ORM\Column(type'datetime'nullabletrue)]
  25.     private $created;
  26.     #[ORM\Column(type'datetime'nullabletrue)]
  27.     private $modified;
  28.     #[ORM\Column(type'boolean'nullabletrue)]
  29.     private $isActive;
  30.     #[ORM\Column(type'string'length255nullabletrue)]
  31.     #[Groups(["main"])]
  32.     private $slug;
  33.     #[ORM\Column(type'string'length255nullabletrue)]
  34.     #[Groups(["main"])]
  35.     private $titleTag;
  36.     #[ORM\Column(type'text'nullabletrue)]
  37.     #[Groups(["main"])]
  38.     private $metaDescription;
  39.     #[ORM\Column(type'string'length255nullabletrue)]
  40.     #[Groups(["main"])]
  41.     private $keywords;
  42.     #[ORM\OneToMany(mappedBy'page'targetEntityPageTranslation::class, cascade: ['persist''remove'], orphanRemovaltrue)]
  43.     private $translations;
  44.     #[ORM\OneToMany(mappedBy'page'targetEntityParagraph::class)]
  45.     private Collection $paragraphs;
  46.     public function getTranslations()
  47.     {
  48.         return $this->translations;
  49.     }
  50.     public function __construct()
  51.     {
  52.         $this->translations = new ArrayCollection();
  53.         $this->created = new DateTime();
  54.         $this->paragraphs = new ArrayCollection();
  55.     }
  56.     public function getId(): ?int
  57.     {
  58.         return $this->id;
  59.     }
  60.     public function getTitle(): ?string
  61.     {
  62.         return $this->title;
  63.     }
  64.     public function setTitle(?string $title): self
  65.     {
  66.         $this->title $title;
  67.         return $this;
  68.     }
  69.     public function getImage(): ?string
  70.     {
  71.         return $this->image;
  72.     }
  73.     public function setImage(?string $image): self
  74.     {
  75.         $this->image $image;
  76.         return $this;
  77.     }
  78.     public function getText(): ?string
  79.     {
  80.         return $this->text;
  81.     }
  82.     public function setText(?string $text): self
  83.     {
  84.         $this->text $text;
  85.         return $this;
  86.     }
  87.     public function getCreated(): ?\DateTimeInterface
  88.     {
  89.         return $this->created;
  90.     }
  91.     public function setCreated(?\DateTimeInterface $created): self
  92.     {
  93.         $this->created $created;
  94.         return $this;
  95.     }
  96.     public function getModified(): ?\DateTimeInterface
  97.     {
  98.         return $this->modified;
  99.     }
  100.     public function setModified(?\DateTimeInterface $modified): self
  101.     {
  102.         $this->modified $modified;
  103.         return $this;
  104.     }
  105.     public function getIsActive(): ?bool
  106.     {
  107.         return $this->isActive;
  108.     }
  109.     public function setIsActive(?bool $isActive): self
  110.     {
  111.         $this->isActive $isActive;
  112.         return $this;
  113.     }
  114.     public function getSlug(): ?string
  115.     {
  116.         return $this->slug;
  117.     }
  118.     public function setSlug(?string $slug): self
  119.     {
  120.         $this->slug $slug;
  121.         return $this;
  122.     }
  123.     public function getTitleTag(): ?string
  124.     {
  125.         return $this->titleTag;
  126.     }
  127.     public function setTitleTag(?string $titleTag): self
  128.     {
  129.         $this->titleTag $titleTag;
  130.         return $this;
  131.     }
  132.     public function getMetaDescription(): ?string
  133.     {
  134.         return $this->metaDescription;
  135.     }
  136.     public function setMetaDescription(?string $metaDescription): self
  137.     {
  138.         $this->metaDescription $metaDescription;
  139.         return $this;
  140.     }
  141.     public function getKeywords(): ?string
  142.     {
  143.         return $this->keywords;
  144.     }
  145.     public function setKeywords(?string $keywords): self
  146.     {
  147.         $this->keywords $keywords;
  148.         return $this;
  149.     }
  150.     public function addTranslation(PageTranslation $t)
  151.     {
  152.         if (!$this->translations->contains($t)) {
  153.             $this->translations[] = $t;
  154.             $t->setPage($this);
  155.         }
  156.     }
  157.     /**
  158.      * @return Collection<int, Paragraph>
  159.      */
  160.     public function getParagraphs(): Collection
  161.     {
  162.         return $this->paragraphs;
  163.     }
  164.     public function addParagraph(Paragraph $paragraph): self
  165.     {
  166.         if (!$this->paragraphs->contains($paragraph)) {
  167.             $this->paragraphs->add($paragraph);
  168.             $paragraph->setPage($this);
  169.         }
  170.         return $this;
  171.     }
  172.     public function removeParagraph(Paragraph $paragraph): self
  173.     {
  174.         if ($this->paragraphs->removeElement($paragraph)) {
  175.             // set the owning side to null (unless already changed)
  176.             if ($paragraph->getPage() === $this) {
  177.                 $paragraph->setPage(null);
  178.             }
  179.         }
  180.         return $this;
  181.     }
  182. }