src/Entity/Template/Page.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Template;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Component\HttpFoundation\File\File;
  7. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  8. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  9. use Symfony\Component\Validator\Constraints as Assert;
  10. /**
  11.  * @ORM\Entity(repositoryClass="App\Repository\Template\PageRepository")
  12.  * @UniqueEntity("seoUrl")
  13.  * @Vich\Uploadable
  14.  */
  15. class Page
  16. {
  17.     /**
  18.      * @ORM\Id()
  19.      * @ORM\GeneratedValue()
  20.      * @ORM\Column(type="integer")
  21.      */
  22.     private $id;
  23.     /**
  24.      * @ORM\Column(type="string", length=255)
  25.      */
  26.     private $titre;
  27.     /**
  28.      * @ORM\Column(type="string", length=255)
  29.      */
  30.     private $seoUrl;
  31.     /**
  32.      * @ORM\Column(type="boolean", nullable=true)
  33.      */
  34.     private $sitemap;
  35.     //--------------------------------------------------------- 
  36.     //                  VICHUPLOADER propriété START
  37.     //--------------------------------------------------------- 
  38.     /**
  39.      * @ORM\Column(type="text", nullable=true)
  40.      */
  41.     private $imageEnTete;
  42.     /**
  43.      * @Vich\UploadableField(mapping="template_page", fileNameProperty="imageEnTete")
  44.      * @Assert\File(
  45.      *     maxSize = "350k",
  46.      *     maxSizeMessage = "La taille maximale autorisée et de {{ limit }} {{ suffix }}, {{ name }} fait {{ size }} {{ suffix }}.",
  47.      *     mimeTypes = {"image/jpg", "image/jpeg", "image/png", "image/svg", "image/webp"},
  48.      *     mimeTypesMessage = "{{ name }} possède un format non pris en charge ({{ type }}), les formats autorisés sont : {{ types }}."
  49.      * )
  50.      * @var File
  51.      */
  52.     private $imageFile;
  53.     /**
  54.      * @ORM\Column(type="date")
  55.      */
  56.     private $date;
  57.     //--------------------------------------------------------- 
  58.     //                  VICHUPLOADER propriété END
  59.     //--------------------------------------------------------- 
  60.     /**
  61.      * @ORM\Column(type="boolean", nullable=true)
  62.      */
  63.     private $navbarActive;
  64.     /**
  65.      * @ORM\Column(type="boolean", nullable=true)
  66.      */
  67.     private $navbarTopActive;
  68.     /**
  69.      * @ORM\Column(type="boolean", nullable=true)
  70.      */
  71.     private $footerActive;
  72.     /**
  73.      * @ORM\Column(type="boolean", nullable=true)
  74.      */
  75.     private $navbarSousMenu;
  76.     /**
  77.      * @ORM\Column(type="integer", nullable=true)
  78.      */
  79.     private $navbarPosition;
  80.     /**
  81.      * @ORM\Column(type="string", length=255, nullable=true)
  82.      */
  83.     private $navbarTitre;
  84.     /**
  85.      * @ORM\OneToMany(targetEntity="App\Entity\Template\Row", mappedBy="page", orphanRemoval=true, cascade={"all"})
  86.      * @ORM\OrderBy({"placement" = "ASC"})
  87.      */
  88.     private $rows;
  89.     /**
  90.      * @ORM\Column(type="string", length=255, nullable=true)
  91.      */
  92.     private $metaTitle;
  93.     /**
  94.      * @ORM\Column(type="text", nullable=true)
  95.      */
  96.     private $metaDescription;
  97.     /**
  98.      * @ORM\Column(type="boolean", nullable=true)
  99.      */
  100.     private $isContactForm;
  101.     /**
  102.      * @ORM\Column(type="string", length=255, nullable=true)
  103.      */
  104.     private $imageAlt;
  105.     /**
  106.      * @ORM\Column(type="boolean", nullable=true)
  107.      */
  108.     private $instantExpert;
  109.     public function __construct()
  110.     {
  111.         $this->rows = new ArrayCollection();
  112.         $this->date = new \DateTime('now');
  113.     }
  114.     //--------------------------------------------------------- 
  115.     //                  VICHUPLOADER méthode START
  116.     //--------------------------------------------------------- 
  117.     public function setImageFile(File $url null)
  118.     {
  119.         $this->imageFile $url;
  120.         // VERY IMPORTANT:
  121.         // It is required that at least one field changes if you are using Doctrine,
  122.         // otherwise the event listeners won't be called and the file is lost
  123.         if ($url) {
  124.             // if 'updatedAt' is not defined in your entity, use another property
  125.             $this->date = new \DateTime('now');
  126.         }
  127.     }
  128.     public function getImageFile()
  129.     {
  130.         return $this->imageFile;
  131.     }
  132.     //--------------------------------------------------------- 
  133.     //                  VICHUPLOADER méthode END
  134.     //--------------------------------------------------------- 
  135.     public function getId(): ?int
  136.     {
  137.         return $this->id;
  138.     }
  139.     public function getTitre(): ?string
  140.     {
  141.         return $this->titre;
  142.     }
  143.     public function setTitre(string $titre): self
  144.     {
  145.         $this->titre $titre;
  146.         return $this;
  147.     }
  148.     public function getSeoUrl(): ?string
  149.     {
  150.         return $this->seoUrl;
  151.     }
  152.     public function setSeoUrl(string $seoUrl): self
  153.     {
  154.         $this->seoUrl $seoUrl;
  155.         return $this;
  156.     }
  157.     public function getSitemap(): ?bool
  158.     {
  159.         return $this->sitemap;
  160.     }
  161.     public function setSitemap(?bool $sitemap): self
  162.     {
  163.         $this->sitemap $sitemap;
  164.         return $this;
  165.     }
  166.     public function getImageEnTete(): ?string
  167.     {
  168.         return $this->imageEnTete;
  169.     }
  170.     public function setImageEnTete(?string $imageEnTete): self
  171.     {
  172.         $this->imageEnTete $imageEnTete;
  173.         return $this;
  174.     }
  175.     public function getNavbarActive(): ?bool
  176.     {
  177.         return $this->navbarActive;
  178.     }
  179.     public function setNavbarActive(?bool $navbarActive): self
  180.     {
  181.         $this->navbarActive $navbarActive;
  182.         return $this;
  183.     }
  184.     public function getNavbarTopActive(): ?bool
  185.     {
  186.         return $this->navbarTopActive;
  187.     }
  188.     public function setNavbarTopActive(?bool $navbarTopActive): self
  189.     {
  190.         $this->navbarTopActive $navbarTopActive;
  191.         return $this;
  192.     }
  193.     public function getNavbarSousMenu(): ?bool
  194.     {
  195.         return $this->navbarSousMenu;
  196.     }
  197.     public function setNavbarSousMenu(?bool $navbarSousMenu): self
  198.     {
  199.         $this->navbarSousMenu $navbarSousMenu;
  200.         return $this;
  201.     }
  202.     public function getFooterActive(): ?bool
  203.     {
  204.         return $this->footerActive;
  205.     }
  206.     public function setFooterActive(?bool $footerActive): self
  207.     {
  208.         $this->footerActive $footerActive;
  209.         return $this;
  210.     }
  211.     public function getNavbarPosition(): ?int
  212.     {
  213.         return $this->navbarPosition;
  214.     }
  215.     public function setNavbarPosition(?int $navbarPosition): self
  216.     {
  217.         $this->navbarPosition $navbarPosition;
  218.         return $this;
  219.     }
  220.     public function getNavbarTitre(): ?string
  221.     {
  222.         return $this->navbarTitre;
  223.     }
  224.     public function setNavbarTitre(?string $navbarTitre): self
  225.     {
  226.         $this->navbarTitre $navbarTitre;
  227.         return $this;
  228.     }
  229.     /**
  230.      * @return Collection|Row[]
  231.      */
  232.     public function getRows(): Collection
  233.     {
  234.         return $this->rows;
  235.     }
  236.     public function addRow(Row $row): self
  237.     {
  238.         if (!$this->rows->contains($row)) {
  239.             $this->rows[] = $row;
  240.             $row->setPage($this);
  241.         }
  242.         return $this;
  243.     }
  244.     public function removeRow(Row $row): self
  245.     {
  246.         if ($this->rows->contains($row)) {
  247.             $this->rows->removeElement($row);
  248.             // set the owning side to null (unless already changed)
  249.             if ($row->getPage() === $this) {
  250.                 $row->setPage(null);
  251.             }
  252.         }
  253.         return $this;
  254.     }
  255.     public function getMetaTitle(): ?string
  256.     {
  257.         return $this->metaTitle;
  258.     }
  259.     public function setMetaTitle(?string $metaTitle): self
  260.     {
  261.         $this->metaTitle $metaTitle;
  262.         return $this;
  263.     }
  264.     public function getMetaDescription(): ?string
  265.     {
  266.         return $this->metaDescription;
  267.     }
  268.     public function setMetaDescription(?string $metaDescription): self
  269.     {
  270.         $this->metaDescription $metaDescription;
  271.         return $this;
  272.     }
  273.     public function getIsContactForm(): ?bool
  274.     {
  275.         return $this->isContactForm;
  276.     }
  277.     public function setIsContactForm(?bool $isContactForm): self
  278.     {
  279.         $this->isContactForm $isContactForm;
  280.         return $this;
  281.     }
  282.     public function getImageAlt(): ?string
  283.     {
  284.         return $this->imageAlt;
  285.     }
  286.     public function setImageAlt(?string $imageAlt): self
  287.     {
  288.         $this->imageAlt $imageAlt;
  289.         return $this;
  290.     }
  291.     public function getInstantExpert(): ?bool
  292.     {
  293.         return $this->instantExpert;
  294.     }
  295.     public function setInstantExpert(?bool $instantExpert): self
  296.     {
  297.         $this->instantExpert $instantExpert;
  298.         return $this;
  299.     }
  300. }