<?php
namespace App\Entity;
use App\Repository\LandingPageRepository;
use Cofondateur\SocleTechniqueBundle\Annotation\CrudField;
use Cofondateur\SocleTechniqueBundle\Traits\SEOInterface;
use Cofondateur\SocleTechniqueBundle\Traits\SEOTrait;
use Cofondateur\SocleTechniqueBundle\Traits\SluggableInterface;
use Cofondateur\SocleTechniqueBundle\Traits\SluggableTrait;
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;
use Vich\UploaderBundle\Mapping\Annotation\Uploadable;
use App\Form\BlocFormType;
/**
* @ORM\Entity(repositoryClass=LandingPageRepository::class)
* @Uploadable()
*/
class LandingPage implements SEOInterface, SluggableInterface
{
use SEOTrait;
use SluggableTrait;
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string")
*/
private $coverName;
/**
* @ORM\Column(type="integer")
*/
private $coverSize;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $coverUpdatedAt;
/**
* @Vich\UploadableField(mapping="default", fileNameProperty="coverName", size="coverSize")
* @CrudField(label="Visuel principal (bandeau top)")
*/
private $coverFile;
/**
* @ORM\Column(type="string", nullable=true)
* @CrudField(label="Alt du visuel principal")
*/
private $coverAlt;
/**
* @ORM\Column(type="string", length=255)
* @CrudField(label="Titre (bandeau top) (mettre entre étoiles pour rendre le titre en bleu. Exemple : 'ceci est en noir *ceci est bleu*')")
*/
private $title;
/**
* @ORM\Column(type="string", length=255)
* @CrudField(label="Sur titre (bandeau top)")
*/
private $subTitle;
/**
* @ORM\Column(type="string", length=255)
* @CrudField(tab="Introduction", label="Sur titre")
*/
private $introSubTitle;
/**
* @ORM\Column(type="string", length=255)
* @CrudField(tab="Introduction", label="Titre (mettre entre étoiles pour rendre le titre en bleu. Exemple : 'ceci est en noir *ceci est bleu*')")
*/
private $introTitle;
/**
* @ORM\Column(type="text")
* @CrudField(tab="Introduction", label="Paragraphe")
*/
private $introParagraph;
/**
* @ORM\OneToMany(targetEntity=Bloc::class, mappedBy="landingPage", cascade={"persist", "remove"}, orphanRemoval=true)
* @CrudField(label="Paragraphes", formType=BlocFormType::class, tab="Paragraphes")
*/
private $blocs;
/**
* @ORM\ManyToMany(targetEntity=Testimony::class, inversedBy="landingPages")
* @CrudField(label="Témoignages", tab="Témoignages")
*/
private $testimonies;
public function __construct()
{
$this->blocs = new ArrayCollection();
$this->testimonies = new ArrayCollection();
}
public function __toString(): string
{
return $this->getId() ?? "N/A";
}
public function getId(): ?int
{
return $this->id;
}
public function getCoverName(): ?string
{
return $this->coverName;
}
public function setCoverName(?string $coverName): self
{
$this->coverName = $coverName;
return $this;
}
public function getCoverSize(): ?int
{
return $this->coverSize;
}
public function setCoverSize(?int $coverSize): self
{
$this->coverSize = $coverSize;
return $this;
}
public function getCoverUpdatedAt(): ?\DateTimeInterface
{
return $this->coverUpdatedAt;
}
public function setCoverUpdatedAt(?\DateTimeInterface $coverUpdatedAt): self
{
$this->coverUpdatedAt = $coverUpdatedAt;
return $this;
}
public function getCoverFile(): ?File
{
return $this->coverFile;
}
public function setCoverFile(?File $coverFile): self
{
$this->coverFile = $coverFile;
if (null !== $this->coverFile) {
$this->coverUpdatedAt = new \DateTimeImmutable();
}
return $this;
}
public function getCoverAlt(): ?string
{
return $this->coverAlt;
}
public function setCoverAlt(?string $coverAlt): self
{
$this->coverAlt = $coverAlt;
return $this;
}
public function getTitle(): ?string
{
return $this->title;
}
public function getTitleIndex(): ?string
{
return $this->title;
}
public function setTitle(string $title): self
{
$this->title = $title;
return $this;
}
public function getSubTitle(): ?string
{
return $this->subTitle;
}
public function setSubTitle(string $subTitle): self
{
$this->subTitle = $subTitle;
return $this;
}
public function getIntroSubTitle(): ?string
{
return $this->introSubTitle;
}
public function setIntroSubTitle(string $introSubTitle): self
{
$this->introSubTitle = $introSubTitle;
return $this;
}
public function getIntroTitle(): ?string
{
return $this->introTitle;
}
public function setIntroTitle(string $introTitle): self
{
$this->introTitle = $introTitle;
return $this;
}
public function getIntroParagraph(): ?string
{
return $this->introParagraph;
}
public function setIntroParagraph(string $introParagraph): self
{
$this->introParagraph = $introParagraph;
return $this;
}
/**
* @return Collection<int, Bloc>
*/
public function getBlocs(): Collection
{
return $this->blocs;
}
public function addBloc(Bloc $bloc): self
{
if (!$this->blocs->contains($bloc)) {
$this->blocs[] = $bloc;
$bloc->setLandingPage($this);
}
return $this;
}
public function removeBloc(Bloc $bloc): self
{
if ($this->blocs->removeElement($bloc)) {
// set the owning side to null (unless already changed)
if ($bloc->getLandingPage() === $this) {
$bloc->setLandingPage(null);
}
}
return $this;
}
/**
* @return Collection<int, Testimony>
*/
public function getTestimonies(): Collection
{
return $this->testimonies;
}
public function addTestimony(Testimony $testimony): self
{
if (!$this->testimonies->contains($testimony)) {
$this->testimonies[] = $testimony;
}
return $this;
}
public function removeTestimony(Testimony $testimony): self
{
$this->testimonies->removeElement($testimony);
return $this;
}
}