src/Entity/Page.php line 13
<?php
namespace App\Entity;
use App\Repository\PageRepository;
use DateTime;
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: PageRepository::class)]
class Page
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
#[Groups(["main"])]
private $title;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $image;
#[ORM\Column(type: 'text', nullable: true)]
#[Groups(["main"])]
private $text;
#[ORM\Column(type: 'datetime', nullable: true)]
private $created;
#[ORM\Column(type: 'datetime', nullable: true)]
private $modified;
#[ORM\Column(type: 'boolean', nullable: true)]
private $isActive;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
#[Groups(["main"])]
private $slug;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
#[Groups(["main"])]
private $titleTag;
#[ORM\Column(type: 'text', nullable: true)]
#[Groups(["main"])]
private $metaDescription;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
#[Groups(["main"])]
private $keywords;
#[ORM\OneToMany(mappedBy: 'page', targetEntity: PageTranslation::class, cascade: ['persist', 'remove'], orphanRemoval: true)]
private $translations;
#[ORM\OneToMany(mappedBy: 'page', targetEntity: Paragraph::class)]
private Collection $paragraphs;
public function getTranslations()
{
return $this->translations;
}
public function __construct()
{
$this->translations = new ArrayCollection();
$this->created = new DateTime();
$this->paragraphs = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(?string $title): self
{
$this->title = $title;
return $this;
}
public function getImage(): ?string
{
return $this->image;
}
public function setImage(?string $image): self
{
$this->image = $image;
return $this;
}
public function getText(): ?string
{
return $this->text;
}
public function setText(?string $text): self
{
$this->text = $text;
return $this;
}
public function getCreated(): ?\DateTimeInterface
{
return $this->created;
}
public function setCreated(?\DateTimeInterface $created): self
{
$this->created = $created;
return $this;
}
public function getModified(): ?\DateTimeInterface
{
return $this->modified;
}
public function setModified(?\DateTimeInterface $modified): self
{
$this->modified = $modified;
return $this;
}
public function getIsActive(): ?bool
{
return $this->isActive;
}
public function setIsActive(?bool $isActive): self
{
$this->isActive = $isActive;
return $this;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug(?string $slug): self
{
$this->slug = $slug;
return $this;
}
public function getTitleTag(): ?string
{
return $this->titleTag;
}
public function setTitleTag(?string $titleTag): self
{
$this->titleTag = $titleTag;
return $this;
}
public function getMetaDescription(): ?string
{
return $this->metaDescription;
}
public function setMetaDescription(?string $metaDescription): self
{
$this->metaDescription = $metaDescription;
return $this;
}
public function getKeywords(): ?string
{
return $this->keywords;
}
public function setKeywords(?string $keywords): self
{
$this->keywords = $keywords;
return $this;
}
public function addTranslation(PageTranslation $t)
{
if (!$this->translations->contains($t)) {
$this->translations[] = $t;
$t->setPage($this);
}
}
/**
* @return Collection<int, Paragraph>
*/
public function getParagraphs(): Collection
{
return $this->paragraphs;
}
public function addParagraph(Paragraph $paragraph): self
{
if (!$this->paragraphs->contains($paragraph)) {
$this->paragraphs->add($paragraph);
$paragraph->setPage($this);
}
return $this;
}
public function removeParagraph(Paragraph $paragraph): self
{
if ($this->paragraphs->removeElement($paragraph)) {
// set the owning side to null (unless already changed)
if ($paragraph->getPage() === $this) {
$paragraph->setPage(null);
}
}
return $this;
}
}