src/CmsBundle/Entity/StaticContent.php line 49

Open in your IDE?
  1. <?php
  2. namespace App\CmsBundle\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Symfony\Component\DependencyInjection\Loader\Configurator\Traits\PropertyTrait;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use \DateTime;
  7. /**
  8.  * StaticContent
  9.  *
  10.  * @ORM\Table(
  11.  *     name="static_content",
  12.  *     indexes={
  13.  *         @ORM\Index(
  14.  *              name="static_content_site_index",
  15.  *              columns={"site_id"}
  16.  *         ),
  17.  *         @ORM\Index(
  18.  *              name="static_content_type_index",
  19.  *              columns={"type"}
  20.  *         ),
  21.  *         @ORM\Index(
  22.  *              name="static_content_path_index",
  23.  *              columns={"path"}
  24.  *         ),
  25.  *         @ORM\Index(
  26.  *              name="static_content_position_index",
  27.  *              columns={"position"}
  28.  *         ),
  29.  *         @ORM\Index(
  30.  *              name="static_content_priority_index",
  31.  *              columns={"priority"}
  32.  *         ),
  33.  *         @ORM\Index(
  34.  *              name="static_content_select_index",
  35.  *              columns={"site_id","path","type","published"}
  36.  *         ),
  37.  *         @ORM\Index(
  38.  *              name="static_content_published_index",
  39.  *              columns={"published"}
  40.  *         )
  41.  *     }
  42.  * )
  43.  * @ORM\Entity(repositoryClass="App\CmsBundle\Repository\StaticContentRepository")
  44.  * @ORM\HasLifecycleCallbacks()
  45.  */
  46. class StaticContent
  47. {
  48.     use IdTraitSiteTraitTypeTraitTitleTraitAlternativeTitleTraitContentTraitPathTraitPositionTraitPropertyTrait,
  49.         TimeStampedTraitParametersTraitPriorityTraitClearCacheRequiredTraitPublishedTrait;
  50.     protected const MODIFICATION_PROPERTIES = ['title''content'];
  51.     protected const SYNCHRONIZATION_PROPERTIES = ['position''parameters''type''path'];
  52.     /**
  53.      * @return string
  54.      */
  55.     public function __toString(): string
  56.     {
  57.         return $this->getTitle();
  58.     }
  59.     /**
  60.      * @ORM\ManyToOne(targetEntity="App\CmsBundle\Entity\Site")
  61.      * @ORM\JoinColumn(name="site_id", referencedColumnName="id", nullable=true)
  62.      */
  63.     private $site;
  64.     /**
  65.      * @ORM\ManyToOne(targetEntity="App\CmsBundle\Entity\Page", inversedBy="staticContents")
  66.      * @ORM\JoinColumn(name="page_id", referencedColumnName="id", nullable=true, onDelete="CASCADE")
  67.      */
  68.     private $page;
  69.     /**
  70.      * @ORM\Column(type="text", nullable=true)
  71.      */
  72.     private $parameters;
  73.     /**
  74.      * @var integer
  75.      * @ORM\Column(name="priority", type="integer", nullable=false, options={"default" : 1})
  76.      */
  77.     private $priority;
  78.     /**
  79.      * @var bool
  80.      * @ORM\Column(name="display_title", type="boolean", nullable=false, options={"default" : true})
  81.      */
  82.     private bool $displayTitle;
  83.     /**
  84.      * @ORM\Column(name="publish_date", type="datetime", nullable=true, options={"default": "CURRENT_TIMESTAMP"})
  85.      */
  86.     private ?DateTime $publishDate;
  87.     /**
  88.      * @var mixed
  89.      */
  90.     private mixed $cdnImages;
  91.     /**
  92.      * @var string|null
  93.      * @ORM\Column(name="toc_alternative_title", type="string", length=255, nullable=true)
  94.      */
  95.     private ?string $tocAlternativeTitle null;
  96.     public function __construct()
  97.     {
  98.     }
  99.     /**
  100.      * @return string|null
  101.      */
  102.     public function getTocAlternativeTitle(): ?string
  103.     {
  104.         return $this->tocAlternativeTitle;
  105.     }
  106.     /**
  107.      * @param string|null $tocAlternativeTitle
  108.      * @return $this
  109.      */
  110.     public function setTocAlternativeTitle(?string $tocAlternativeTitle): self
  111.     {
  112.         $this->tocAlternativeTitle $tocAlternativeTitle;
  113.         return $this;
  114.     }
  115.     /**
  116.      * @return mixed
  117.      */
  118.     public function getCdnImages(): mixed
  119.     {
  120.         return $this->cdnImages;
  121.     }
  122.     /**
  123.      * @param ?mixed $cdnImages
  124.      * @return void
  125.      */
  126.     public function setCdnImages(mixed $cdnImages): void
  127.     {
  128.         $this->cdnImages $cdnImages;
  129.     }
  130.     /**
  131.      * @return ?DateTime
  132.      */
  133.     public function getPublishDate(): ?DateTime
  134.     {
  135.         return $this->publishDate;
  136.     }
  137.     /**
  138.      * @param ?DateTime $publishDate
  139.      * @return $this
  140.      */
  141.     public function setPublishDate(?DateTime $publishDate): self
  142.     {
  143.         $this->publishDate $publishDate;
  144.         return $this;
  145.     }
  146.     /**
  147.      * @param Page|null $page
  148.      * @return $this
  149.      */
  150.     public function setPage(?Page $page): self
  151.     {
  152.         $this->page $page;
  153.         $this->setSite($page->getSite());
  154.         $this->setPath($page->getPath());
  155.         return $this;
  156.     }
  157.     /**
  158.      * @return Page|null
  159.      */
  160.     public function getPage(): ?Page
  161.     {
  162.         return $this->page;
  163.     }
  164.     /**
  165.      * @return bool
  166.      */
  167.     public function getDisplayTitle(): bool
  168.     {
  169.         return $this->displayTitle;
  170.     }
  171.     /**
  172.      * @param bool $displayTitle
  173.      * @return $this
  174.      */
  175.     public function setDisplayTitle(bool $displayTitle): self
  176.     {
  177.         $this->displayTitle $displayTitle;
  178.         return $this;
  179.     }
  180. }