<?php
namespace App\Entity\Page;
use App\Entity\Components\HardComponent;
use App\Entity\Page\ContentGroupPage;
use App\Entity\Page\PageType;
use App\Repository\Page\PageRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: PageRepository::class)]
class Page
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $name = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $title = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $status = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $metaDescription = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $metaImg = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $javascriptAdd = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $cssAdd = null;
#[ORM\Column(type: Types::TEXT)]
private ?string $content = null;
#[ORM\Column(length: 255)]
private ?string $urlAccess = null;
#[ORM\Column]
private ?bool $is_activ = null;
#[ORM\Column]
private ?bool $is_contact = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $draft = null;
#[ORM\Column(length: 30, nullable: true)]
private ?string $skeleton = null;
#[ORM\ManyToOne]
private ?HardComponent $hardComponent = null;
#[ORM\Column(nullable: true)]
private ?bool $is_headerComponent = null;
#[ORM\Column(nullable: true)]
private ?bool $is_noIndex = null;
#[ORM\Column(nullable: true)]
private ?bool $is_home = null;
#[ORM\Column(nullable: true)]
private ?bool $is_legal = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $created_at = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $updated_at = null;
#[ORM\ManyToOne(inversedBy: 'pages')]
private ?PageType $pageType = null;
#[ORM\Column(length: 30, nullable: true)]
private ?string $visibility = null;
#[ORM\Column(nullable: true)]
private ?int $readingOrder = null;
#[ORM\OneToMany(mappedBy: 'page', targetEntity: ContentGroupPage::class)]
private Collection $contentGroupPages;
public function __construct()
{
$this->contentGroupPages = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(?string $name): self
{
$this->name = $name;
return $this;
}
public function getStatus(): ?string
{
return $this->status;
}
public function setStatus(?string $status): self
{
$this->status = $status;
return $this;
}
public function getMetaDescription(): ?string
{
return $this->metaDescription;
}
public function setMetaDescription(?string $metaDescription): self
{
$this->metaDescription = $metaDescription;
return $this;
}
public function getMetaImg(): ?string
{
return $this->metaImg;
}
public function setMetaImg(?string $metaImg): self
{
$this->metaImg = $metaImg;
return $this;
}
public function getJavascriptAdd(): ?string
{
return $this->javascriptAdd;
}
public function setJavascriptAdd(?string $javascriptAdd): self
{
$this->javascriptAdd = $javascriptAdd;
return $this;
}
public function getCssAdd(): ?string
{
return $this->cssAdd;
}
public function setCssAdd(?string $cssAdd): self
{
$this->cssAdd = $cssAdd;
return $this;
}
public function getContent(): ?string
{
return $this->content;
}
public function setContent(string $content): self
{
$this->content = $content;
return $this;
}
public function getUrlAccess(): ?string
{
return $this->urlAccess;
}
public function setUrlAccess(string $urlAccess): self
{
$this->urlAccess = $urlAccess;
return $this;
}
public function isIsActiv(): ?bool
{
return $this->is_activ;
}
public function setIsActiv(bool $is_activ): self
{
$this->is_activ = $is_activ;
return $this;
}
public function isIsContact(): ?bool
{
return $this->is_contact;
}
public function setIsContact(bool $is_contact): self
{
$this->is_contact = $is_contact;
return $this;
}
public function getDraft(): ?string
{
return $this->draft;
}
public function setDraft(?string $draft): self
{
$this->draft = $draft;
return $this;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(?string $title): self
{
$this->title = $title;
return $this;
}
public function getSkeleton(): ?string
{
return $this->skeleton;
}
public function setSkeleton(?string $skeleton): static
{
$this->skeleton = $skeleton;
return $this;
}
public function getHardComponent(): ?HardComponent
{
return $this->hardComponent;
}
public function setHardComponent(?HardComponent $hardComponent): static
{
$this->hardComponent = $hardComponent;
return $this;
}
public function isIsHeaderComponent(): ?bool
{
return $this->is_headerComponent;
}
public function setIsHeaderComponent(?bool $is_headerComponent): static
{
$this->is_headerComponent = $is_headerComponent;
return $this;
}
public function isIsNoIndex(): ?bool
{
return $this->is_noIndex;
}
public function setIsNoIndex(?bool $is_noIndex): static
{
$this->is_noIndex = $is_noIndex;
return $this;
}
public function isIsHome(): ?bool
{
return $this->is_home;
}
public function setIsHome(?bool $is_home): static
{
$this->is_home = $is_home;
return $this;
}
public function isIsLegal(): ?bool
{
return $this->is_legal;
}
public function setIsLegal(?bool $is_legal): static
{
$this->is_legal = $is_legal;
return $this;
}
public function getcreatedAt(): ?\DateTimeInterface
{
return $this->created_at;
}
public function setCreatedAt(?\DateTimeInterface $created_at): static
{
$this->created_at = $created_at;
return $this;
}
public function getUpdatedAt(): ?\DateTimeInterface
{
return $this->updated_at;
}
public function setUpdatedAt(?\DateTimeInterface $updated_at): static
{
$this->updated_at = $updated_at;
return $this;
}
public function getPageType(): ?PageType
{
return $this->pageType;
}
public function setPageType(?PageType $pageType): static
{
$this->pageType = $pageType;
return $this;
}
public function getVisibility(): ?string
{
return $this->visibility;
}
public function setVisibility(?string $visibility): static
{
$this->visibility = $visibility;
return $this;
}
public function getReadingOrder(): ?int
{
return $this->readingOrder;
}
public function setReadingOrder(?int $readingOrder): static
{
$this->readingOrder = $readingOrder;
return $this;
}
/**
* @return Collection<int, ContentGroupPage>
*/
public function getContentGroupPages(): Collection
{
return $this->contentGroupPages;
}
public function addContentGroupPage(ContentGroupPage $contentGroupPage): static
{
if (!$this->contentGroupPages->contains($contentGroupPage)) {
$this->contentGroupPages->add($contentGroupPage);
$contentGroupPage->setPage($this);
}
return $this;
}
public function removeContentGroupPage(ContentGroupPage $contentGroupPage): static
{
if ($this->contentGroupPages->removeElement($contentGroupPage)) {
// set the owning side to null (unless already changed)
if ($contentGroupPage->getPage() === $this) {
$contentGroupPage->setPage(null);
}
}
return $this;
}
public function getPublicUrl(): string
{
if ($this->pageType && $this->pageType->getSlug()) {
return '/t/' . $this->pageType->getSlug() . '/' . $this->urlAccess;
}
return '/page/' . $this->urlAccess;
}
}