src/Entity/PagePreview.php line 23

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Traits\ImageUploadTrait;
  4. use App\Entity\Traits\LinkTrait;
  5. use App\Entity\Traits\MetaTrait;
  6. use App\Entity\Traits\SubTitleTrait;
  7. use App\Entity\Traits\TitleAndContentTrait;
  8. use App\Entity\Traits\TranslateTrait;
  9. use Doctrine\ORM\Mapping as ORM;
  10. use Gedmo\Mapping\Annotation as Gedmo;
  11. use Gedmo\Timestampable\Traits\TimestampableEntity;
  12. use Symfony\Component\Validator\Constraints as Assert;
  13. /**
  14.  * @Gedmo\Loggable
  15.  *
  16.  * @Gedmo\TranslationEntity(class="App\Entity\PagePreviewTranslations")
  17.  */
  18. #[ORM\Entity(repositoryClass\App\Repository\PageRepository::class)]
  19. #[ORM\Table(name'page_preview')]
  20. class PagePreview
  21. {
  22.     use TitleAndContentTrait;
  23.     use SubTitleTrait;
  24.     use LinkTrait;
  25.     use MetaTrait;
  26.     use ImageUploadTrait;
  27.     use TimestampableEntity;
  28.     use TranslateTrait;
  29.     #[ORM\Column(name'components'type'array'nullabletrue)]
  30.     protected array $components = [];
  31.     #[ORM\Column(name'extraUrlsegments'type'array'nullabletrue)]
  32.     protected array $extraUrlsegments = [];
  33.     #[ORM\Column(name'htmlblocks'type'array'nullabletrue)]
  34.     protected array $htmlblocks = [];
  35.     #[ORM\Id]
  36.     #[ORM\GeneratedValue]
  37.     #[ORM\Column(type'integer')]
  38.     private int $id;
  39.     /**
  40.      * @Gedmo\Translatable
  41.      */
  42.     #[Assert\NotBlank(message'The menu title should not be blank')]
  43.     #[ORM\Column(name'navtitle'type'string'length128)]
  44.     private ?string $navtitle null;
  45.     /**
  46.      * @Gedmo\Translatable
  47.      */
  48.     #[ORM\Column(name'content'type'text'nullabletrue)]
  49.     private ?string $content null;
  50.     /**
  51.      * @Gedmo\Translatable
  52.      */
  53.     #[ORM\Column(name'content2'type'text'nullabletrue)]
  54.     private ?string $content2 null;
  55.     #[ORM\Column(name'featured_image'type'string'length255nullabletrue)]
  56.     private ?string $featuredImage null;
  57.     #[ORM\ManyToOne(targetEntity\App\Entity\Page::class, inversedBy'pagePreviews')]
  58.     private ?Page $page null;
  59.     /**
  60.      * Get id.
  61.      *
  62.      * @return int
  63.      */
  64.     public function getId()
  65.     {
  66.         return $this->id;
  67.     }
  68.     /**
  69.      * Set navtitle.
  70.      *
  71.      * @param string $navtitle
  72.      *
  73.      * @return PagePreview
  74.      */
  75.     public function setNavtitle($navtitle)
  76.     {
  77.         $this->navtitle $navtitle;
  78.         return $this;
  79.     }
  80.     /**
  81.      * Get navtitle.
  82.      *
  83.      * @return string
  84.      */
  85.     public function getNavtitle()
  86.     {
  87.         return $this->navtitle;
  88.     }
  89.     /**
  90.      * Set content.
  91.      *
  92.      * @param string $content
  93.      *
  94.      * @return PagePreview
  95.      */
  96.     public function setContent($content)
  97.     {
  98.         $this->content $content;
  99.         return $this;
  100.     }
  101.     /**
  102.      * Get content.
  103.      *
  104.      * @return string
  105.      */
  106.     public function getContent()
  107.     {
  108.         return $this->content;
  109.     }
  110.     /**
  111.      * Set content2.
  112.      *
  113.      * @param string $content2
  114.      *
  115.      * @return PagePreview
  116.      */
  117.     public function setContent2($content2)
  118.     {
  119.         $this->content2 $content2;
  120.         return $this;
  121.     }
  122.     /**
  123.      * Get content2.
  124.      *
  125.      * @return string
  126.      */
  127.     public function getContent2()
  128.     {
  129.         return $this->content2;
  130.     }
  131.     /**
  132.      * Set components.
  133.      *
  134.      * @param array $components
  135.      *
  136.      * @return PagePreview
  137.      */
  138.     public function setComponents($components)
  139.     {
  140.         $this->components $components;
  141.         return $this;
  142.     }
  143.     /**
  144.      * Get components.
  145.      *
  146.      * @return array
  147.      */
  148.     public function getComponents()
  149.     {
  150.         return $this->components;
  151.     }
  152.     /**
  153.      * Set extraUrlsegments.
  154.      *
  155.      * @param array $extraUrlsegments
  156.      *
  157.      * @return PagePreview
  158.      */
  159.     public function setExtraUrlsegments($extraUrlsegments)
  160.     {
  161.         $this->extraUrlsegments $extraUrlsegments;
  162.         return $this;
  163.     }
  164.     /**
  165.      * Get extraUrlsegments.
  166.      *
  167.      * @return array
  168.      */
  169.     public function getExtraUrlsegments()
  170.     {
  171.         return $this->extraUrlsegments;
  172.     }
  173.     /**
  174.      * Set htmlblocks.
  175.      *
  176.      * @param array $htmlblocks
  177.      *
  178.      * @return PagePreview
  179.      */
  180.     public function setHtmlblocks($htmlblocks)
  181.     {
  182.         $this->htmlblocks $htmlblocks;
  183.         return $this;
  184.     }
  185.     /**
  186.      * Get htmlblocks.
  187.      *
  188.      * @return array
  189.      */
  190.     public function getHtmlblocks()
  191.     {
  192.         return $this->htmlblocks;
  193.     }
  194.     /**
  195.      * Set featuredImage.
  196.      *
  197.      * @param string $featuredImage
  198.      *
  199.      * @return PagePreview
  200.      */
  201.     public function setFeaturedImage($featuredImage)
  202.     {
  203.         $this->featuredImage $featuredImage;
  204.         return $this;
  205.     }
  206.     /**
  207.      * Get featuredImage.
  208.      *
  209.      * @return string
  210.      */
  211.     public function getFeaturedImage()
  212.     {
  213.         return $this->featuredImage;
  214.     }
  215.     /**
  216.      * Set page.
  217.      *
  218.      * @return PagePreview
  219.      */
  220.     public function setPage(Page $page null)
  221.     {
  222.         $this->page $page;
  223.         return $this;
  224.     }
  225.     /**
  226.      * Get page.
  227.      *
  228.      * @return \App\Entity\Page
  229.      */
  230.     public function getPage()
  231.     {
  232.         return $this->page;
  233.     }
  234.     // REQUIRED BY THE META LINKS TRAIT - NOT REALLY NEEDED HERE BUT WHATEVS :)
  235.     public function getLinkedPageId(): int
  236.     {
  237.         return 1;
  238.     }
  239. }