src/Entity/Pages/Pages.php line 23

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Pages;
  3. use App\Entity\Fiches\Articles;
  4. use Doctrine\DBAL\Types\Types;
  5. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  6. use Symfony\Component\Validator\Constraints as Assert;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  9. use Symfony\Component\HttpFoundation\File\File;
  10. use Symfony\Component\HttpFoundation\File\UploadedFile;
  11. use Vich\UploaderBundle\Entity\File as EmbeddedFile;
  12. /**
  13.  * Pages
  14.  *
  15.  * @ORM\Table("pages_pages")
  16.  * @ORM\Entity(repositoryClass="App\Repository\Pages\PagesRepository")
  17.  * @ORM\HasLifecycleCallbacks()
  18.  * @Vich\Uploadable
  19.  */
  20. class Pages
  21. {
  22.     /**
  23.      * @var integer
  24.      *
  25.      * @ORM\Column(name="id", type="integer")
  26.      * @ORM\Id
  27.      * @ORM\GeneratedValue(strategy="AUTO")
  28.      */
  29.     protected $id;
  30.     /**
  31.      * @var string
  32.      *
  33.      * @ORM\Column(name="created_at", type="datetime", nullable=true, options={"comment":"Date de création"})
  34.      */
  35.     private $createdAt;
  36.     /**
  37.      * @var string
  38.      *
  39.      * @ORM\Column(name="updated_at", type="datetime", nullable=true, options={"comment":"Date de mise à jour"})
  40.      */
  41.     private $updatedAt;
  42.     /**
  43.      * @var string
  44.      *
  45.      * @ORM\Column(name="name", type="string", length=255, nullable=true)
  46.      */
  47.     private $name;
  48.     /**
  49.      * @var string
  50.      *
  51.      * @ORM\Column(name="folder_slug", type="string", length=255, nullable=true)
  52.      */
  53.     private $folderSlug;
  54.     /**
  55.      * @var string
  56.      *
  57.      * @ORM\Column(name="folder_slug2", type="string", length=255, nullable=true)
  58.      */
  59.     private $folderSlug2;
  60.     /**
  61.      * @var string
  62.      *
  63.      * @ORM\Column(name="folder_slug3", type="string", length=255, nullable=true)
  64.      */
  65.     private $folderSlug3;
  66.     /**
  67.      * @var string
  68.      *
  69.      * @ORM\Column(name="title", type="string", length=255, nullable=true)
  70.      */
  71.     private $title;
  72.     /**
  73.      * @var string
  74.      *
  75.      * @ORM\Column(name="short_title", type="string", length=255, nullable=true)
  76.      */
  77.     private $shortTitle;
  78.     /**
  79.      * @var string
  80.      *
  81.      * @ORM\Column(name="description", type="text", nullable=true)
  82.      */
  83.     private $description;
  84.     /**
  85.      * @var string
  86.      *
  87.      * @ORM\Column(name="short_description", type="text", nullable=true)
  88.      */
  89.     private $shortDescription;
  90.     /**
  91.      * @var string
  92.      *
  93.      * @ORM\Column(name="views", type="integer", nullable=true)
  94.      */
  95.     private $views;
  96.     /**
  97.      * @var string
  98.      *
  99.      * @ORM\Column(name="locale", type="string", length=11, nullable=true)
  100.      */
  101.     private $locale;
  102.     /**
  103.      * @var string
  104.      *
  105.      * @ORM\Column(name="noblock", type="boolean", nullable=true)
  106.      */
  107.     private $noblock;
  108.     /**
  109.      * @var string
  110.      *
  111.      * @ORM\Column(name="robots", type="string", length=255, nullable=true)
  112.      */
  113.     private $robots;
  114.     /**
  115.      * @var string
  116.      *
  117.      * @ORM\Column(name="type", type="string", length=255, nullable=true)
  118.      */
  119.     private $type;
  120.     /**
  121.      * @var string
  122.      *
  123.      * @ORM\Column(name="sitemap", type="boolean", nullable=true)
  124.      */
  125.     private $sitemap;
  126.     /**
  127.      * @var string
  128.      *
  129.      * @ORM\Column(name="menu_absolute", type="boolean", nullable=true)
  130.      */
  131.     private $menuAbsolute;
  132.     /**
  133.      * @var string
  134.      *
  135.      * @ORM\Column(name="theme", type="string", length=255, nullable=true)
  136.      */
  137.     private $theme;
  138.     /**
  139.      * @var string
  140.      *
  141.      * @ORM\Column(name="style", type="text", nullable=true)
  142.      */
  143.     private $style;
  144.     /**
  145.      * @var string
  146.      *
  147.      * @ORM\Column(name="javascript", type="text", nullable=true)
  148.      */
  149.     private $javascript;
  150.     /**
  151.      * @var string
  152.      *
  153.      * @ORM\Column(name="redirect", type="text", nullable=true)
  154.      */
  155.     private $redirect;
  156.     /**
  157.      * @var string
  158.      *
  159.      * @ORM\Column(name="identifiant", type="string", length=255, nullable=true)
  160.      */
  161.     private $identifiant;
  162.     /**
  163.      * NOTE: This is not a mapped field of entity metadata, just a simple property.
  164.      *
  165.      * @Vich\UploadableField(mapping="pages_files", fileNameProperty="image.name", size="image.size", mimeType="image.mimeType", originalName="image.originalName", dimensions="image.dimensions")
  166.      *
  167.      * @var File|null
  168.      */
  169.     private $imageFile;
  170.     /**
  171.      * @ORM\Embedded(class="Vich\UploaderBundle\Entity\File")
  172.      *
  173.      * @var EmbeddedFile
  174.      */
  175.     private $image;
  176.     /**
  177.      * @var string
  178.      *
  179.      * @ORM\Column(name="sequence", type="integer", length=11, nullable=true)
  180.      */
  181.     private $sequence;
  182.     /**
  183.      * @var string
  184.      *
  185.      * @ORM\Column(name="canonical", type="text", nullable=true)
  186.      */
  187.     private $canonical;
  188.     /**
  189.      * @var string
  190.      *
  191.      * @ORM\Column(name="author", type="string", length=155, nullable=true)
  192.      */
  193.     private $author;
  194.     /**
  195.      * @var string
  196.      *
  197.      * @ORM\Column(name="premium", type="boolean", nullable=true)
  198.      */
  199.     private $premium;
  200.     /**
  201.      * @var \App\Entity\Fiches\Articles
  202.      *
  203.      * @ORM\ManyToOne(targetEntity="App\Entity\Fiches\Articles")
  204.      * @ORM\JoinColumns({
  205.      *   @ORM\JoinColumn(name="fiche_id", referencedColumnName="id", nullable=true)
  206.      * })
  207.      */
  208.     protected $fiche;
  209.     /**
  210.      * @var string
  211.      *
  212.      * @ORM\Column(name="navbar", type="string", length=155, nullable=true)
  213.      */
  214.     private $navbar;
  215.     /**
  216.      * @var string
  217.      *
  218.      * @ORM\Column(name="navbar_background_color", type="string", length=155, nullable=true)
  219.      */
  220.     private $navbarBG;
  221.     public function __construct() {
  222.         $this->image = new \Vich\UploaderBundle\Entity\File();
  223.     }
  224.     /**
  225.      * @ORM\PrePersist
  226.      */
  227.     public function setCreatedAtValue(): void
  228.     {
  229.         $this->setCreatedAt(new \DateTime("now"));
  230.         $this->setUpdatedAt(new \DateTime("now"));
  231.         $this->setViews(0);
  232.         $this->setType("brouillon");
  233.         $this->setPremium(false);
  234.     }
  235.     /**
  236.      * @ORM\PreUpdate
  237.      */
  238.     public function setUpdatedAtValue(): void
  239.     {
  240.         $this->setUpdatedAt(new \DateTime("now"));
  241.     }
  242.     public function __toString()
  243.     {
  244.         return (string)$this->title;
  245.     }
  246.     /**
  247.      * If manually uploading a file (i.e. not using Symfony Form) ensure an instance
  248.      * of 'UploadedFile' is injected into this setter to trigger the  update. If this
  249.      * bundle's configuration parameter 'inject_on_load' is set to 'true' this setter
  250.      * must be able to accept an instance of 'File' as the bundle will inject one here
  251.      * during Doctrine hydration.
  252.      *
  253.      * @param File|UploadedFile|null $imageFile
  254.      */
  255.     public function setImageFile(?File $imageFile null)
  256.     {
  257.         $this->imageFile $imageFile;
  258.         if (null !== $imageFile) {
  259.             // It is required that at least one field changes if you are using doctrine
  260.             // otherwise the event listeners won't be called and the file is lost
  261.             $this->setUpdatedAt(new \DateTime("now"));
  262.         }
  263.     }
  264.     public function getImageFile(): ?File
  265.     {
  266.         return $this->imageFile;
  267.     }
  268.     public function setImage(EmbeddedFile $image): void
  269.     {
  270.         $this->image $image;
  271.     }
  272.     public function getImage(): ?EmbeddedFile
  273.     {
  274.         return $this->image;
  275.     }
  276.     public function getId(): ?int
  277.     {
  278.         return $this->id;
  279.     }
  280.     public function getCreatedAt(): ?\DateTimeInterface
  281.     {
  282.         return $this->createdAt;
  283.     }
  284.     public function setCreatedAt(?\DateTimeInterface $createdAt): self
  285.     {
  286.         $this->createdAt $createdAt;
  287.         return $this;
  288.     }
  289.     public function getUpdatedAt(): ?\DateTimeInterface
  290.     {
  291.         return $this->updatedAt;
  292.     }
  293.     public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
  294.     {
  295.         $this->updatedAt $updatedAt;
  296.         return $this;
  297.     }
  298.     public function getName(): ?string
  299.     {
  300.         return $this->name;
  301.     }
  302.     public function setName(?string $name): self
  303.     {
  304.         $this->name $name;
  305.         return $this;
  306.     }
  307.     public function getFolderSlug(): ?string
  308.     {
  309.         return $this->folderSlug;
  310.     }
  311.     public function setFolderSlug(?string $folderSlug): self
  312.     {
  313.         $this->folderSlug $folderSlug;
  314.         return $this;
  315.     }
  316.     public function getFolderSlug2(): ?string
  317.     {
  318.         return $this->folderSlug2;
  319.     }
  320.     public function setFolderSlug2(?string $folderSlug2): self
  321.     {
  322.         $this->folderSlug2 $folderSlug2;
  323.         return $this;
  324.     }
  325.     public function getFolderSlug3(): ?string
  326.     {
  327.         return $this->folderSlug3;
  328.     }
  329.     public function setFolderSlug3(?string $folderSlug3): self
  330.     {
  331.         $this->folderSlug3 $folderSlug3;
  332.         return $this;
  333.     }
  334.     public function getTitle(): ?string
  335.     {
  336.         return $this->title;
  337.     }
  338.     public function setTitle(?string $title): self
  339.     {
  340.         $this->title $title;
  341.         return $this;
  342.     }
  343.     public function getShortTitle(): ?string
  344.     {
  345.         return $this->shortTitle;
  346.     }
  347.     public function setShortTitle(?string $shortTitle): self
  348.     {
  349.         $this->shortTitle $shortTitle;
  350.         return $this;
  351.     }
  352.     public function getDescription(): ?string
  353.     {
  354.         return $this->description;
  355.     }
  356.     public function setDescription(?string $description): self
  357.     {
  358.         $this->description $description;
  359.         return $this;
  360.     }
  361.     public function getShortDescription(): ?string
  362.     {
  363.         return $this->shortDescription;
  364.     }
  365.     public function setShortDescription(?string $shortDescription): self
  366.     {
  367.         $this->shortDescription $shortDescription;
  368.         return $this;
  369.     }
  370.     public function getViews(): ?int
  371.     {
  372.         return $this->views;
  373.     }
  374.     public function setViews(?int $views): self
  375.     {
  376.         $this->views $views;
  377.         return $this;
  378.     }
  379.     public function getLocale(): ?string
  380.     {
  381.         return $this->locale;
  382.     }
  383.     public function setLocale(?string $locale): self
  384.     {
  385.         $this->locale $locale;
  386.         return $this;
  387.     }
  388.     public function getNoblock(): ?bool
  389.     {
  390.         return $this->noblock;
  391.     }
  392.     public function setNoblock(?bool $noblock): self
  393.     {
  394.         $this->noblock $noblock;
  395.         return $this;
  396.     }
  397.     public function getRobots(): ?string
  398.     {
  399.         return $this->robots;
  400.     }
  401.     public function setRobots(?string $robots): self
  402.     {
  403.         $this->robots $robots;
  404.         return $this;
  405.     }
  406.     public function getType(): ?string
  407.     {
  408.         return $this->type;
  409.     }
  410.     public function setType(?string $type): self
  411.     {
  412.         $this->type $type;
  413.         return $this;
  414.     }
  415.     public function getSitemap(): ?bool
  416.     {
  417.         return $this->sitemap;
  418.     }
  419.     public function setSitemap(?bool $sitemap): self
  420.     {
  421.         $this->sitemap $sitemap;
  422.         return $this;
  423.     }
  424.     public function getTheme(): ?string
  425.     {
  426.         return $this->theme;
  427.     }
  428.     public function setTheme(?string $theme): self
  429.     {
  430.         $this->theme $theme;
  431.         return $this;
  432.     }
  433.     public function getStyle(): ?string
  434.     {
  435.         return $this->style;
  436.     }
  437.     public function setStyle(?string $style): self
  438.     {
  439.         $this->style $style;
  440.         return $this;
  441.     }
  442.     public function getJavascript(): ?string
  443.     {
  444.         return $this->javascript;
  445.     }
  446.     public function setJavascript(?string $javascript): self
  447.     {
  448.         $this->javascript $javascript;
  449.         return $this;
  450.     }
  451.     public function getRedirect(): ?string
  452.     {
  453.         return $this->redirect;
  454.     }
  455.     public function setRedirect(?string $redirect): self
  456.     {
  457.         $this->redirect $redirect;
  458.         return $this;
  459.     }
  460.     public function getIdentifiant(): ?string
  461.     {
  462.         return $this->identifiant;
  463.     }
  464.     public function setIdentifiant(?string $identifiant): self
  465.     {
  466.         $this->identifiant $identifiant;
  467.         return $this;
  468.     }
  469.     public function getSequence(): ?int
  470.     {
  471.         return $this->sequence;
  472.     }
  473.     public function setSequence(?int $sequence): self
  474.     {
  475.         $this->sequence $sequence;
  476.         return $this;
  477.     }
  478.     public function getCanonical(): ?string
  479.     {
  480.         return $this->canonical;
  481.     }
  482.     public function setCanonical(?string $canonical): self
  483.     {
  484.         $this->canonical $canonical;
  485.         return $this;
  486.     }
  487.     public function getAuthor(): ?string
  488.     {
  489.         return $this->author;
  490.     }
  491.     public function setAuthor(?string $author): self
  492.     {
  493.         $this->author $author;
  494.         return $this;
  495.     }
  496.     public function getMenuAbsolute(): ?bool
  497.     {
  498.         return $this->menuAbsolute;
  499.     }
  500.     public function setMenuAbsolute(?bool $menuAbsolute): self
  501.     {
  502.         $this->menuAbsolute $menuAbsolute;
  503.         return $this;
  504.     }
  505.     public function getPremium(): ?bool
  506.     {
  507.         return $this->premium;
  508.     }
  509.     public function setPremium(?bool $premium): self
  510.     {
  511.         $this->premium $premium;
  512.         return $this;
  513.     }
  514.     public function getFiche(): ?Articles
  515.     {
  516.         return $this->fiche;
  517.     }
  518.     public function setFiche(?Articles $fiche): self
  519.     {
  520.         $this->fiche $fiche;
  521.         return $this;
  522.     }
  523.     public function getNavbar(): ?string
  524.     {
  525.         return $this->navbar;
  526.     }
  527.     public function setNavbar(?string $navbar): self
  528.     {
  529.         $this->navbar $navbar;
  530.         return $this;
  531.     }
  532.     public function getNavbarBG(): ?string
  533.     {
  534.         return $this->navbarBG;
  535.     }
  536.     public function setNavbarBG(?string $navbar): self
  537.     {
  538.         $this->navbarBG $navbar;
  539.         return $this;
  540.     }
  541.     public function isNoblock(): ?bool
  542.     {
  543.         return $this->noblock;
  544.     }
  545.     public function isSitemap(): ?bool
  546.     {
  547.         return $this->sitemap;
  548.     }
  549.     public function isMenuAbsolute(): ?bool
  550.     {
  551.         return $this->menuAbsolute;
  552.     }
  553.     public function isPremium(): ?bool
  554.     {
  555.         return $this->premium;
  556.     }
  557. }