<?php
namespace App\Entity;
use App\Repository\SeoPageRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\File;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
/** @Vich\Uploadable
*/
#[ORM\Entity(repositoryClass: SeoPageRepository::class)]
class SeoPage
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $name;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $default_title;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $default_descripion;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $template;
#[ORM\Column(type: 'text', length: 255, nullable: true)]
private $page_title;
#[ORM\Column(type: 'text', nullable: true)]
private $page_descripion;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $page_media;
#[ORM\Column(type: 'text', nullable: true)]
private $services_title;
#[ORM\Column(type: 'text', nullable: true)]
private $services_description;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $page_video;
#[ORM\OneToMany(targetEntity: PageService::class, mappedBy: 'seopage', orphanRemoval: true, cascade: ['persist', 'remove'])]
private $pageServices;
/**
* @Vich\UploadableField(mapping="services_medias", fileNameProperty="page_media")
* @var File|null
*/
private $Tmppagemedia = null;
#[ORM\ManyToOne(targetEntity: TypeSeoPage::class, inversedBy: 'seoPages')]
#[ORM\JoinColumn(nullable: false)]
private $type;
#[ORM\Column(type: 'datetime', nullable: true)]
private $updatedAt;
public function __construct()
{
$this->pageServices = 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 getDefaultTitle(): ?string
{
return $this->default_title;
}
public function setDefaultTitle(?string $default_title): self
{
$this->default_title = $default_title;
return $this;
}
public function getDefaultDescripion(): ?string
{
return $this->default_descripion;
}
public function setDefaultDescripion(?string $default_descripion): self
{
$this->default_descripion = $default_descripion;
return $this;
}
public function getTemplate(): ?string
{
return $this->template;
}
public function setTemplate(?string $template): self
{
$this->template = $template;
return $this;
}
public function getPageTitle(): ?string
{
return $this->page_title;
}
public function setPageTitle(?string $page_title): self
{
$this->page_title = $page_title;
return $this;
}
public function getPageDescripion(): ?string
{
return $this->page_descripion;
}
public function setPageDescripion(?string $page_descripion): self
{
$this->page_descripion = $page_descripion;
return $this;
}
public function getPageMedia(): ?string
{
return $this->page_media;
}
public function setPageMedia(?string $page_media): self
{
$this->page_media = $page_media;
return $this;
}
public function getServicesTitle(): ?string
{
return $this->services_title;
}
public function setServicesTitle(?string $services_title): self
{
$this->services_title = $services_title;
return $this;
}
public function getServicesDescription(): ?string
{
return $this->services_description;
}
public function setServicesDescription(?string $services_description): self
{
$this->services_description = $services_description;
return $this;
}
public function getPageVideo(): ?string
{
return $this->page_video;
}
public function setPageVideo(string $page_video): self
{
$this->page_video = $page_video;
return $this;
}
/**
* @return Collection|PageService[]
*/
public function getPageServices(): Collection
{
// var_dump($this->pageServices);exit;
return $this->pageServices;
}
public function addPageService(PageService $pageService): self
{
if (!$this->pageServices->contains($pageService)) {
$this->pageServices[] = $pageService;
$pageService->setSeopage($this);
}
return $this;
}
public function removePageService(PageService $pageService): self
{
if ($this->pageServices->removeElement($pageService)) {
// set the owning side to null (unless already changed)
if ($pageService->getSeopage() === $this) {
$pageService->setSeopage(null);
}
}
return $this;
}
public function setTmpPageMedia(?File $Tmppagemedia = null): void
{
$this->Tmppagemedia = $Tmppagemedia;
if ($Tmppagemedia) {
$this->updatedAt = new \DateTime('now');
}
}
public function getTmpPageMedia() : ?File
{
return $this->Tmppagemedia;
}
public function getType(): ?TypeSeoPage
{
return $this->type;
}
public function setType(?TypeSeoPage $type): self
{
$this->type = $type;
return $this;
}
public function getUpdatedAt(): ?\DateTimeInterface
{
return $this->updatedAt;
}
public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
{
$this->updatedAt = $updatedAt;
return $this;
}
}