src/Entity/LandingPage.php line 24

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\LandingPageRepository;
  4. use Cofondateur\SocleTechniqueBundle\Annotation\CrudField;
  5. use Cofondateur\SocleTechniqueBundle\Traits\SEOInterface;
  6. use Cofondateur\SocleTechniqueBundle\Traits\SEOTrait;
  7. use Cofondateur\SocleTechniqueBundle\Traits\SluggableInterface;
  8. use Cofondateur\SocleTechniqueBundle\Traits\SluggableTrait;
  9. use Doctrine\Common\Collections\ArrayCollection;
  10. use Doctrine\Common\Collections\Collection;
  11. use Doctrine\ORM\Mapping as ORM;
  12. use Symfony\Component\HttpFoundation\File\File;
  13. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  14. use Vich\UploaderBundle\Mapping\Annotation\Uploadable;
  15. use App\Form\BlocFormType;
  16. /**
  17.  * @ORM\Entity(repositoryClass=LandingPageRepository::class)
  18.  * @Uploadable()
  19.  */
  20. class LandingPage implements SEOInterfaceSluggableInterface
  21. {
  22.     
  23.     use SEOTrait;
  24.         
  25.     use SluggableTrait;
  26.     
  27.     /**
  28.      * @ORM\Id
  29.      * @ORM\GeneratedValue
  30.      * @ORM\Column(type="integer")
  31.      */
  32.     private $id;
  33.     /**
  34.      * @ORM\Column(type="string")
  35.      */
  36.     private $coverName;
  37.     /**
  38.      * @ORM\Column(type="integer")
  39.      */
  40.     private $coverSize;
  41.     /**
  42.      * @ORM\Column(type="datetime", nullable=true)
  43.      */
  44.     private $coverUpdatedAt;
  45.     /**
  46.      * @Vich\UploadableField(mapping="default", fileNameProperty="coverName", size="coverSize")
  47.      * @CrudField(label="Visuel principal (bandeau top)")
  48.      */
  49.     private $coverFile;
  50.     /**
  51.      * @ORM\Column(type="string", nullable=true)
  52.      * @CrudField(label="Alt du visuel principal")
  53.      */
  54.     private $coverAlt;
  55.     /**
  56.      * @ORM\Column(type="string", length=255)
  57.      * @CrudField(label="Titre (bandeau top) (mettre entre étoiles pour rendre le titre en bleu. Exemple : 'ceci est en noir *ceci est bleu*')")
  58.      */
  59.     private $title;
  60.     /**
  61.      * @ORM\Column(type="string", length=255)
  62.      * @CrudField(label="Sur titre (bandeau top)")
  63.      */
  64.     private $subTitle;
  65.     /**
  66.      * @ORM\Column(type="string", length=255)
  67.      * @CrudField(tab="Introduction", label="Sur titre")
  68.      */
  69.     private $introSubTitle;
  70.     /**
  71.      * @ORM\Column(type="string", length=255)
  72.      * @CrudField(tab="Introduction", label="Titre (mettre entre étoiles pour rendre le titre en bleu. Exemple : 'ceci est en noir *ceci est bleu*')")
  73.      */
  74.     private $introTitle;
  75.     /**
  76.      * @ORM\Column(type="text")
  77.      * @CrudField(tab="Introduction", label="Paragraphe")
  78.      */
  79.     private $introParagraph;
  80.     /**
  81.      * @ORM\OneToMany(targetEntity=Bloc::class, mappedBy="landingPage", cascade={"persist", "remove"}, orphanRemoval=true)
  82.      * @CrudField(label="Paragraphes", formType=BlocFormType::class, tab="Paragraphes")
  83.      */
  84.     private $blocs;
  85.     /**
  86.      * @ORM\ManyToMany(targetEntity=Testimony::class, inversedBy="landingPages")
  87.      * @CrudField(label="Témoignages", tab="Témoignages")
  88.      */
  89.     private $testimonies;
  90.     public function __construct()
  91.     {
  92.         $this->blocs = new ArrayCollection();
  93.         $this->testimonies = new ArrayCollection();
  94.     }
  95.     public function __toString(): string
  96.     {
  97.         return $this->getId() ?? "N/A";
  98.     }
  99.     public function getId(): ?int
  100.     {
  101.         return $this->id;
  102.     }
  103.     public function getCoverName(): ?string
  104.     {
  105.         return $this->coverName;
  106.     }
  107.     public function setCoverName(?string $coverName): self
  108.     {
  109.         $this->coverName $coverName;
  110.         return $this;
  111.     }
  112.     public function getCoverSize(): ?int
  113.     {
  114.         return $this->coverSize;
  115.     }
  116.     public function setCoverSize(?int $coverSize): self
  117.     {
  118.         $this->coverSize $coverSize;
  119.         return $this;
  120.     }
  121.     public function getCoverUpdatedAt(): ?\DateTimeInterface
  122.     {
  123.         return $this->coverUpdatedAt;
  124.     }
  125.     public function setCoverUpdatedAt(?\DateTimeInterface $coverUpdatedAt): self
  126.     {
  127.         $this->coverUpdatedAt $coverUpdatedAt;
  128.         return $this;
  129.     }
  130.     public function getCoverFile(): ?File
  131.     {
  132.         return $this->coverFile;
  133.     }
  134.     public function setCoverFile(?File $coverFile): self
  135.     {
  136.         $this->coverFile $coverFile;
  137.         if (null !== $this->coverFile) {
  138.             $this->coverUpdatedAt = new \DateTimeImmutable();
  139.         }
  140.         return $this;
  141.     }
  142.     public function getCoverAlt(): ?string
  143.     {
  144.         return $this->coverAlt;
  145.     }
  146.     public function setCoverAlt(?string $coverAlt): self
  147.     {
  148.         $this->coverAlt $coverAlt;
  149.         return $this;
  150.     }
  151.     public function getTitle(): ?string
  152.     {
  153.         return $this->title;
  154.     }
  155.     public function getTitleIndex(): ?string
  156.     {
  157.         return $this->title;
  158.     }
  159.     public function setTitle(string $title): self
  160.     {
  161.         $this->title $title;
  162.         return $this;
  163.     }
  164.     public function getSubTitle(): ?string
  165.     {
  166.         return $this->subTitle;
  167.     }
  168.     public function setSubTitle(string $subTitle): self
  169.     {
  170.         $this->subTitle $subTitle;
  171.         return $this;
  172.     }
  173.     public function getIntroSubTitle(): ?string
  174.     {
  175.         return $this->introSubTitle;
  176.     }
  177.     public function setIntroSubTitle(string $introSubTitle): self
  178.     {
  179.         $this->introSubTitle $introSubTitle;
  180.         return $this;
  181.     }
  182.     public function getIntroTitle(): ?string
  183.     {
  184.         return $this->introTitle;
  185.     }
  186.     public function setIntroTitle(string $introTitle): self
  187.     {
  188.         $this->introTitle $introTitle;
  189.         return $this;
  190.     }
  191.     public function getIntroParagraph(): ?string
  192.     {
  193.         return $this->introParagraph;
  194.     }
  195.     public function setIntroParagraph(string $introParagraph): self
  196.     {
  197.         $this->introParagraph $introParagraph;
  198.         return $this;
  199.     }
  200.     /**
  201.      * @return Collection<int, Bloc>
  202.      */
  203.     public function getBlocs(): Collection
  204.     {
  205.         return $this->blocs;
  206.     }
  207.     public function addBloc(Bloc $bloc): self
  208.     {
  209.         if (!$this->blocs->contains($bloc)) {
  210.             $this->blocs[] = $bloc;
  211.             $bloc->setLandingPage($this);
  212.         }
  213.         return $this;
  214.     }
  215.     public function removeBloc(Bloc $bloc): self
  216.     {
  217.         if ($this->blocs->removeElement($bloc)) {
  218.             // set the owning side to null (unless already changed)
  219.             if ($bloc->getLandingPage() === $this) {
  220.                 $bloc->setLandingPage(null);
  221.             }
  222.         }
  223.         return $this;
  224.     }
  225.     /**
  226.      * @return Collection<int, Testimony>
  227.      */
  228.     public function getTestimonies(): Collection
  229.     {
  230.         return $this->testimonies;
  231.     }
  232.     public function addTestimony(Testimony $testimony): self
  233.     {
  234.         if (!$this->testimonies->contains($testimony)) {
  235.             $this->testimonies[] = $testimony;
  236.         }
  237.         return $this;
  238.     }
  239.     public function removeTestimony(Testimony $testimony): self
  240.     {
  241.         $this->testimonies->removeElement($testimony);
  242.         return $this;
  243.     }
  244. }