src/CmsBundle/Entity/Page.php line 40

Open in your IDE?
  1. <?php
  2. namespace App\CmsBundle\Entity;
  3. use App\CasinoBundle\Entity\Author;
  4. use App\CmsBundle\Enum\PrimeImagePositionEnum;
  5. use App\CmsBundle\Enum\RobotsValue;
  6. use App\CmsBundle\Enum\StatusCodeEnum;
  7. use App\CmsBundle\Helper\StringHelper;
  8. use Doctrine\Common\Collections\ArrayCollection;
  9. use Doctrine\Common\Collections\Collection;
  10. use Google\Type\DateTime;
  11. use Symfony\Component\Validator\Constraints as Assert;
  12. use Doctrine\ORM\Mapping as ORM;
  13. /**
  14.  * @ORM\Entity(repositoryClass="App\CmsBundle\Repository\PageRepository")
  15.  * @ORM\Table(
  16.  *     name="page",
  17.  *     indexes={
  18.  *         @ORM\Index(name="page_site_idx", columns={"site_id"}),
  19.  *         @ORM\Index(name="page_path_idx", columns={"path"}),
  20.  *         @ORM\Index(name="page_published_idx", columns={"published"}),
  21.  *         @ORM\Index(name="page_canonical_url_idx", columns={"canonical_url"}),
  22.  *         @ORM\Index(name="page_slug_idx", columns={"slug"}),
  23.  *         @ORM\Index(name="page_hreflang_idx", columns={"hreflang_published"}),
  24.  *         @ORM\Index(name="page_ctr_updated", columns={"ctr_updated"}),
  25.  *         @ORM\Index(name="page_related_to_idx", columns={"related_to_id"}),
  26.  *         @ORM\Index(name="page_redirect_url_idx", columns={"redirect_url"}),
  27.  *         @ORM\Index(name="page_author_idx", columns={"author_id"}),
  28.  *         @ORM\Index(name="page_reviewer_idx", columns={"reviewer_id"})
  29.  *     },
  30.  *     uniqueConstraints={
  31.  *         @ORM\UniqueConstraint(name="page_uindex", columns={"route_id","path"}),
  32.  *         @ORM\UniqueConstraint(name="page_site_path_uindex", columns={"site_id","path"})
  33.  *     }
  34.  * )
  35.  * @ORM\HasLifecycleCallbacks()
  36.  */
  37. class Page
  38. {
  39.     use IdTraitTitleTraitAlternativeTitleTraitPathTraitDescriptionTraitPublishedTraitSiteTraitParametersTraitTimeStampedTraitSlugTrait;
  40.     /**
  41.      * @ORM\ManyToOne(targetEntity="App\CmsBundle\Entity\Site")
  42.      * @ORM\JoinColumn(name="site_id", referencedColumnName="id", nullable=false, onDelete="CASCADE")
  43.      */
  44.     private $site;
  45.     /**
  46.      * @ORM\OneToOne(targetEntity="App\CmsBundle\Entity\DirectoryItem", inversedBy="page")
  47.      * @ORM\JoinColumn(name="directory_item_id", referencedColumnName="id", nullable=true, onDelete="CASCADE")
  48.      */
  49.     private $directoryItem;
  50.     /**
  51.      * @ORM\ManyToOne(targetEntity="App\CmsBundle\Entity\Route", inversedBy="pages")
  52.      * @ORM\JoinColumn(nullable=true, onDelete="CASCADE")
  53.      */
  54.     private $route;
  55.     /**
  56.      * @ORM\ManyToOne(targetEntity="App\CmsBundle\Entity\Template", inversedBy="pages")
  57.      * @ORM\JoinColumn(nullable=true)
  58.      */
  59.     private $template;
  60.     /**
  61.      * @ORM\Column(type="string", length=255, nullable=true)
  62.      */
  63.     private $h1;
  64.     /**
  65.      * @ORM\Column(type="string", length=255, nullable=true)
  66.      */
  67.     private $alternativeH1;
  68.     /**
  69.      * @ORM\Column(type="string", length=255, nullable=true)
  70.      */
  71.     private $breadcrumbsTitle;
  72.     /**
  73.      * @ORM\Column(type="string", length=255, nullable=true)
  74.      */
  75.     private $breadcrumbsPattern;
  76.     /**
  77.      * @ORM\Column(type="string", length=255, nullable=true)
  78.      */
  79.     private $summaryTitle;
  80.     /**
  81.      * @ORM\Column(type="string", length=255, nullable=true)
  82.      */
  83.     private $canonicalUrl;
  84.     /**
  85.      * @ORM\Column(type="string", length=255, nullable=true)
  86.      */
  87.     private $redirectUrl;
  88.     /**
  89.      * @ORM\Column(type="integer", nullable=true)
  90.      */
  91.     private $robots;
  92.     /**
  93.      * @ORM\Column(type="string", options={"default" : "D"})
  94.      * @Assert\Regex("/\b[A-D]\b/")
  95.      */
  96.     private $seoPriority 'D';
  97.     /**
  98.      * @ORM\OneToMany(targetEntity="App\CmsBundle\Entity\StaticContent", fetch="EXTRA_LAZY", mappedBy="page")
  99.      * @ORM\JoinColumn(nullable=true)
  100.      */
  101.     private $staticContents;
  102.     /**
  103.      * @ORM\Column(type="text", nullable=true)
  104.      */
  105.     private $alternativeDescription;
  106.     /**
  107.      * @ORM\Column(
  108.      *     type="boolean", options={"default":"0"}, nullable=true
  109.      * )
  110.      */
  111.     private $crawl;
  112.     private $syncPage;
  113.     /**
  114.      * @ORM\Column(type="string", length=255, nullable=true)
  115.      */
  116.     private $backgroundUrlDesktop;
  117.     /**
  118.      * @ORM\Column(type="string", length=255, nullable=true)
  119.      */
  120.     private $backgroundUrlMobile;
  121.     /**
  122.      * @ORM\Column(type="boolean", nullable=false, options={"default" : false})
  123.      */
  124.     private $displayPrimeImages false;
  125.     /**
  126.      * @ORM\Column(type="integer", nullable=true, options={"default" : 1})
  127.      */
  128.     private $primeImagePosition PrimeImagePositionEnum::RIGHT;
  129.     /**
  130.      * @ORM\Column(type="string", length=255, nullable=true)
  131.      */
  132.     private $primeImageDesktop;
  133.     private $removePrimeImageDesktop;
  134.     private $removePrimeImageMobile;
  135.     /**
  136.      * @ORM\Column(type="string", length=255, nullable=true)
  137.      */
  138.     private $primeImageMobile;
  139.     /**
  140.      * @ORM\Column(type="string", length=255, nullable=true)
  141.      */
  142.     private $primeImageAlt;
  143.     /**
  144.      * @ORM\Column(type="string", length=255, nullable=true)
  145.      */
  146.     private $primeGradient;
  147.     /**
  148.      * @ORM\Column(type="integer", options={"default" : "200"})
  149.      */
  150.     private $statusCode 200;
  151.     /**
  152.      *
  153.      * @ORM\OneToMany(targetEntity="App\CmsBundle\Entity\Bullet", mappedBy="page", cascade={"persist"}, orphanRemoval=true)
  154.      * @ORM\JoinColumn(nullable=true)
  155.      */
  156.     private Collection $bullet;
  157.     /**
  158.      * @ORM\Column(
  159.      *     type="boolean", options={"default":"1"}, nullable=true
  160.      * )
  161.      */
  162.     private $hreflangPublished;
  163.     /**
  164.      * @ORM\Column(type="string", length=255, nullable=true)
  165.      */
  166.     private $mainKeyword;
  167.     /**
  168.      * @ORM\Column(type="string", length=255, nullable=true)
  169.      */
  170.     private $altKeywords;
  171.     /**
  172.      * @ORM\ManyToOne(targetEntity="App\CmsBundle\Entity\Page", inversedBy="relates", fetch="EXTRA_LAZY")
  173.      * @ORM\JoinColumn(nullable=true)
  174.      */
  175.     private $relatedTo;
  176.     /**
  177.      * @ORM\OneToMany(targetEntity="App\CmsBundle\Entity\Page", mappedBy="relatedTo", cascade={"persist","remove"})
  178.      */
  179.     private $relates;
  180.     /**
  181.      * @ORM\OneToMany(
  182.      *     targetEntity=PageTag::class,
  183.      *     mappedBy="page",
  184.      *     cascade={"persist"},
  185.      *     orphanRemoval=true
  186.      * )
  187.      */
  188.     private Collection $pageTags;
  189.     /**
  190.      * @ORM\OneToMany(targetEntity="App\CmsBundle\Entity\Ctr", mappedBy="page", fetch="EXTRA_LAZY")
  191.      */
  192.     private $ctr;
  193.     /**
  194.      * @var DateTime
  195.      *
  196.      * @ORM\Column(name="ctr_updated", type="google_datetime", nullable=true)
  197.      */
  198.     private $ctrUpdated;
  199.     /**
  200.      * @ORM\ManyToOne(targetEntity="App\CmsBundle\Entity\Locale", inversedBy="pages")
  201.      * @ORM\JoinColumn(nullable=true)
  202.      */
  203.     private $htmlLang;
  204.     /**
  205.      * @ORM\Column(type="string", length=255, nullable=true)
  206.      */
  207.     private $hreflangUrl;
  208.     /**
  209.      * @ORM\ManyToOne(targetEntity="App\CasinoBundle\Entity\Author")
  210.      * @ORM\JoinColumn(name="author_id", referencedColumnName="id", nullable=true)
  211.      */
  212.     private ?Author $author null;
  213.     /**
  214.      * @ORM\ManyToOne(targetEntity="App\CasinoBundle\Entity\Author")
  215.      * @ORM\JoinColumn(name="reviewer_id", referencedColumnName="id", nullable=true)
  216.      */
  217.     private ?Author $reviewer null;
  218.     public function __construct()
  219.     {
  220.         $this->staticContents = new ArrayCollection();
  221.         $this->bullet = new ArrayCollection();
  222.         $this->relates = new ArrayCollection();
  223.         $this->pageTags = new ArrayCollection();
  224.         $this->ctr = new ArrayCollection();
  225.     }
  226.     /**
  227.      * @return string
  228.      */
  229.     public function __toString(): string
  230.     {
  231.         return $this->getPath();
  232.     }
  233.     public function getParameters(): array
  234.     {
  235.         return array_merge(
  236.             json_decode($this->parameters ?? ''true) ?? [],
  237.             [
  238.                 'id'                   => (string)$this->id,
  239.                 'backgroundUrlDesktop' => $this->getBackgroundUrlDesktop(),
  240.                 'backgroundUrlMobile'  => $this->getBackgroundUrlMobile(),
  241.                 'displayPrimeImages'   => $this->getDisplayPrimeImages(),
  242.                 'primeImagePosition'   => $this->getPrimeImagePosition(),
  243.                 'primeImageDesktop'    => $this->getPrimeImageDesktop(),
  244.                 'primeImageMobile'     => $this->getPrimeImageMobile(),
  245.                 'primeImageAlt'        => $this->getPrimeImageAlt(),
  246.                 'primeGradient'        => $this->getPrimeGradient(),
  247.                 'canonicalUrl'         => $this->getCanonicalUrl()
  248.             ]
  249.         );
  250.     }
  251.     /**
  252.      * @return array
  253.      */
  254.     public function getAutoReplacedVariables(): array
  255.     {
  256.         return [
  257.             '{pageTitle}'        => $this->alternativeTitle ?? $this->title,
  258.             '{description}'      => $this->alternativeDescription ?? $this->description,
  259.             '{h1}'               => $this->alternativeH1 ?? $this->h1,
  260.             '{breadcrumbsTitle}' => $this->breadcrumbsTitle,
  261.             '{summaryTitle}'     => $this->summaryTitle
  262.         ];
  263.     }
  264.     /**
  265.      * @return string|null
  266.      */
  267.     public function getPageUrl(): ?string
  268.     {
  269.         if (is_null($this->getSite())) return null;
  270.         return $this->getSite()->getDomain() . $this->getPath();
  271.     }
  272.     /**
  273.      * @return int|null
  274.      */
  275.     public function getId(): ?int
  276.     {
  277.         return $this->id;
  278.     }
  279.     /**
  280.      * @return string|null
  281.      */
  282.     public function getH1(): ?string
  283.     {
  284.         return $this->h1;
  285.     }
  286.     /**
  287.      * @param string|null $h1
  288.      * @return $this
  289.      */
  290.     public function setH1(?string $h1): self
  291.     {
  292.         $this->h1 StringHelper::emptyToNull($h1);
  293.         return $this;
  294.     }
  295.     /**
  296.      * @return string|null
  297.      */
  298.     public function getAlternativeH1(): ?string
  299.     {
  300.         return $this->alternativeH1;
  301.     }
  302.     /**
  303.      * @param string|null $alternativeH1
  304.      * @return $this
  305.      */
  306.     public function setAlternativeH1(?string $alternativeH1): self
  307.     {
  308.         $this->alternativeH1 StringHelper::emptyToNull($alternativeH1);
  309.         return $this;
  310.     }
  311.     /**
  312.      * @return string|null
  313.      */
  314.     public function getBreadcrumbsPattern(): ?string
  315.     {
  316.         return $this->breadcrumbsPattern;
  317.     }
  318.     /**
  319.      * @param string|null $breadcrumbsPattern
  320.      * @return $this
  321.      */
  322.     public function setBreadcrumbsPattern(?string $breadcrumbsPattern): self
  323.     {
  324.         $this->breadcrumbsPattern StringHelper::emptyToNull($breadcrumbsPattern);
  325.         return $this;
  326.     }
  327.     /**
  328.      * @return string|null
  329.      */
  330.     public function getBreadcrumbsTitle(): ?string
  331.     {
  332.         return $this->breadcrumbsTitle;
  333.     }
  334.     /**
  335.      * @param string|null $breadcrumbsTitle
  336.      * @return $this
  337.      */
  338.     public function setBreadcrumbsTitle(?string $breadcrumbsTitle): self
  339.     {
  340.         $this->breadcrumbsTitle StringHelper::emptyToNull($breadcrumbsTitle);
  341.         return $this;
  342.     }
  343.     /**
  344.      * @return string|null
  345.      */
  346.     public function getSummaryTitle(): ?string
  347.     {
  348.         return $this->summaryTitle;
  349.     }
  350.     /**
  351.      * @param string|null $summaryTitle
  352.      * @return $this
  353.      */
  354.     public function setSummaryTitle(?string $summaryTitle): self
  355.     {
  356.         $this->summaryTitle StringHelper::emptyToNull($summaryTitle);
  357.         return $this;
  358.     }
  359.     /**
  360.      * @return string|null
  361.      */
  362.     public function getCanonicalUrl(): ?string
  363.     {
  364.         return $this->canonicalUrl;
  365.     }
  366.     /**
  367.      * @return string|null
  368.      */
  369.     public function getCanonical(): ?string
  370.     {
  371.         return $this->getCanonicalUrl();
  372.     }
  373.     /**
  374.      * @return string|null
  375.      */
  376.     public function getSeoPriority(): ?string
  377.     {
  378.         return $this->seoPriority;
  379.     }
  380.     /**
  381.      * @param string|null $seoPriority
  382.      * @return $this
  383.      */
  384.     public function setSeoPriority(?string $seoPriority null): self
  385.     {
  386.         $this->seoPriority $seoPriority;
  387.         return $this;
  388.     }
  389.     /**
  390.      * @param string|null $canonicalUrl
  391.      * @return $this
  392.      */
  393.     public function setCanonicalUrl(?string $canonicalUrl null): self
  394.     {
  395.         $this->canonicalUrl StringHelper::emptyToNull($canonicalUrl);
  396.         return $this;
  397.     }
  398.     /**
  399.      * @return string|null
  400.      */
  401.     public function getHreflangUrl(): ?string
  402.     {
  403.         return $this->hreflangUrl;
  404.     }
  405.     /**
  406.      * @param string|null $hreflangUrl
  407.      * @return $this
  408.      */
  409.     public function setHreflangUrl(?string $hreflangUrl null): self
  410.     {
  411.         $this->hreflangUrl StringHelper::emptyToNull($hreflangUrl);
  412.         return $this;
  413.     }
  414.     /**
  415.      * @return string|null
  416.      */
  417.     public function getRedirectUrl(): ?string
  418.     {
  419.         return $this->redirectUrl;
  420.     }
  421.     /**
  422.      * @param string|null $redirectUrl
  423.      * @return $this
  424.      */
  425.     public function setRedirectUrl(?string $redirectUrl null): self
  426.     {
  427.         if (!is_null($redirectUrl) && !empty($redirectUrl)) {
  428.             $this->statusCode StatusCodeEnum::STATUS_301;
  429.         }
  430.         $this->redirectUrl StringHelper::emptyToNull($redirectUrl);
  431.         return $this;
  432.     }
  433.     /**
  434.      * @return int|null
  435.      */
  436.     public function getRobots(): ?int
  437.     {
  438.         return $this->robots;
  439.     }
  440.     /**
  441.      * @param int|null $robots
  442.      * @return $this
  443.      */
  444.     public function setRobots(?int $robots null): self
  445.     {
  446.         $this->robots $robots;
  447.         return $this;
  448.     }
  449.     /**
  450.      * @return int|null
  451.      */
  452.     public function getPrimeImagePosition(): ?int
  453.     {
  454.         return $this->primeImagePosition;
  455.     }
  456.     /**
  457.      * @param int|null $primeImagePosition
  458.      * @return $this
  459.      */
  460.     public function setPrimeImagePosition(?int $primeImagePosition PrimeImagePositionEnum::RIGHT): self
  461.     {
  462.         $this->primeImagePosition $primeImagePosition;
  463.         return $this;
  464.     }
  465.     /**
  466.      * @return int|null
  467.      */
  468.     public function getStatusCode(): ?int
  469.     {
  470.         return $this->statusCode;
  471.     }
  472.     /**
  473.      * @param int|null $statusCode
  474.      * @return $this
  475.      */
  476.     public function setStatusCode(?int $statusCode StatusCodeEnum::STATUS_200): self
  477.     {
  478.         $this->statusCode $statusCode;
  479.         return $this;
  480.     }
  481.     /**
  482.      * @return string|null
  483.      */
  484.     public function getRobotsValue(): ?string
  485.     {
  486.         return ($this->robots) ? RobotsValue::getValue($this->robots) : null;
  487.     }
  488.     /**
  489.      * @return Route|null
  490.      */
  491.     public function getRoute(): ?Route
  492.     {
  493.         return $this->route;
  494.     }
  495.     /**
  496.      * @param Route|null $route
  497.      * @return $this
  498.      */
  499.     public function setRoute(?Route $route): self
  500.     {
  501.         $this->route $route;
  502.         if ($route$route->addPage($this);
  503.         return $this;
  504.     }
  505.     /**
  506.      * @return Template|null
  507.      */
  508.     public function getTemplate(): ?Template
  509.     {
  510.         return $this->template;
  511.     }
  512.     /**
  513.      * @param Template|null $template
  514.      * @return $this
  515.      */
  516.     public function setTemplate(?Template $template): self
  517.     {
  518.         $this->template $template;
  519.         if ($template) {
  520.             $template->addPage($this);
  521.             $this->setRoute($template->getRoute());
  522.             $this->setSite($template->getRoute()->getSite());
  523.         } else {
  524.             $this->setRoute(null);
  525.             $this->setSite(null);
  526.         }
  527.         return $this;
  528.     }
  529.     /**
  530.      * @return Collection
  531.      */
  532.     public function getStaticContents(): Collection
  533.     {
  534.         if (!$this->staticContents$this->staticContents = new ArrayCollection();
  535.         return $this->staticContents;
  536.     }
  537.     /**
  538.      * @param StaticContent $staticContent
  539.      * @return $this
  540.      */
  541.     public function addStaticContent(StaticContent $staticContent): self
  542.     {
  543.         if (!$this->staticContents->contains($staticContent)) {
  544.             $this->staticContents[] = $staticContent;
  545.             $staticContent->setPage($this);
  546.         }
  547.         return $this;
  548.     }
  549.     /**
  550.      * @param StaticContent $staticContent
  551.      * @return $this
  552.      */
  553.     public function removeStaticContent(StaticContent $staticContent): self
  554.     {
  555.         if ($this->staticContents->contains($staticContent)) {
  556.             $this->staticContents->removeElement($staticContent);
  557.             // set the owning side to null (unless already changed)
  558.             if ($staticContent->getPage() === $this) {
  559.                 $staticContent->setPage(null);
  560.             }
  561.         }
  562.         return $this;
  563.     }
  564.     /**
  565.      * @return string|null
  566.      */
  567.     public function getAlternativeDescription(): ?string
  568.     {
  569.         return $this->alternativeDescription;
  570.     }
  571.     /**
  572.      * @param string|null $alternativeDescription
  573.      * @return $this
  574.      */
  575.     public function setAlternativeDescription(?string $alternativeDescription): self
  576.     {
  577.         $this->alternativeDescription StringHelper::emptyToNull($alternativeDescription);
  578.         return $this;
  579.     }
  580.     /**
  581.      * @return bool
  582.      */
  583.     public function getHreflangPublished(): bool
  584.     {
  585.         return (bool)$this->hreflangPublished;
  586.     }
  587.     /**
  588.      * @param bool $hreflangPublished
  589.      * @return $this
  590.      */
  591.     public function setHreflangPublished(bool $hreflangPublished): self
  592.     {
  593.         $this->hreflangPublished $hreflangPublished;
  594.         return $this;
  595.     }
  596.     /**
  597.      * @return bool
  598.      */
  599.     public function getCrawl(): bool
  600.     {
  601.         return (bool)$this->crawl;
  602.     }
  603.     /**
  604.      * @param bool $crawl
  605.      * @return $this
  606.      */
  607.     public function setCrawl(bool $crawl): self
  608.     {
  609.         $this->crawl $crawl;
  610.         return $this;
  611.     }
  612.     /**
  613.      * @return string|null
  614.      */
  615.     public function getBackgroundUrlDesktop(): ?string
  616.     {
  617.         return $this->backgroundUrlDesktop;
  618.     }
  619.     /**
  620.      * @param string|null $backgroundUrlDesktop
  621.      * @return $this
  622.      */
  623.     public function setBackgroundUrlDesktop(?string $backgroundUrlDesktop): self
  624.     {
  625.         $this->backgroundUrlDesktop $backgroundUrlDesktop;
  626.         return $this;
  627.     }
  628.     /**
  629.      * @return string|null
  630.      */
  631.     public function getBackgroundUrlMobile(): ?string
  632.     {
  633.         return $this->backgroundUrlMobile;
  634.     }
  635.     /**
  636.      * @param string|null $backgroundUrlMobile
  637.      * @return $this
  638.      */
  639.     public function setBackgroundUrlMobile(?string $backgroundUrlMobile): self
  640.     {
  641.         $this->backgroundUrlMobile $backgroundUrlMobile;
  642.         return $this;
  643.     }
  644.     /**
  645.      * @return bool|null
  646.      */
  647.     public function getDisplayPrimeImages(): ?bool
  648.     {
  649.         return $this->displayPrimeImages;
  650.     }
  651.     /**
  652.      * @param bool|null $displayPrimeImages
  653.      * @return $this
  654.      */
  655.     public function setDisplayPrimeImages(?bool $displayPrimeImages): self
  656.     {
  657.         $this->displayPrimeImages $displayPrimeImages;
  658.         return $this;
  659.     }
  660.     /**
  661.      * @return string|null
  662.      */
  663.     public function getPrimeImageDesktop(): ?string
  664.     {
  665.         return $this->primeImageDesktop;
  666.     }
  667.     /**
  668.      * @param string|null $primeImageDesktop
  669.      * @return $this
  670.      */
  671.     public function setPrimeImageDesktop(?string $primeImageDesktop): self
  672.     {
  673.         $this->primeImageDesktop $primeImageDesktop;
  674.         return $this;
  675.     }
  676.     /**
  677.      * @return bool|null
  678.      */
  679.     public function getRemovePrimeImageDesktop(): ?bool
  680.     {
  681.         return $this->removePrimeImageDesktop;
  682.     }
  683.     /**
  684.      * @param bool|null $removePrimeImageDesktop
  685.      * @return $this
  686.      */
  687.     public function setRemovePrimeImageDesktop(?bool $removePrimeImageDesktop): self
  688.     {
  689.         $this->removePrimeImageDesktop $removePrimeImageDesktop;
  690.         return $this;
  691.     }
  692.     /**
  693.      * @return bool|null
  694.      */
  695.     public function getRemovePrimeImageMobile(): ?bool
  696.     {
  697.         return $this->removePrimeImageMobile;
  698.     }
  699.     /**
  700.      * @param bool|null $removePrimeImageMobile
  701.      * @return $this
  702.      */
  703.     public function setRemovePrimeImageMobile(?bool $removePrimeImageMobile): self
  704.     {
  705.         $this->removePrimeImageMobile $removePrimeImageMobile;
  706.         return $this;
  707.     }
  708.     /**
  709.      * @return string|null
  710.      */
  711.     public function getPrimeImageMobile(): ?string
  712.     {
  713.         return $this->primeImageMobile;
  714.     }
  715.     /**
  716.      * @param string|null $primeImageMobile
  717.      * @return $this
  718.      */
  719.     public function setPrimeImageMobile(?string $primeImageMobile): self
  720.     {
  721.         $this->primeImageMobile $primeImageMobile;
  722.         return $this;
  723.     }
  724.     /**
  725.      * @return string|null
  726.      */
  727.     public function getPrimeImageAlt(): ?string
  728.     {
  729.         return $this->primeImageAlt;
  730.     }
  731.     /**
  732.      * @param string|null $primeImageAlt
  733.      * @return $this
  734.      */
  735.     public function setPrimeImageAlt(?string $primeImageAlt): self
  736.     {
  737.         $this->primeImageAlt $primeImageAlt;
  738.         return $this;
  739.     }
  740.     /**
  741.      * @return string|null
  742.      */
  743.     public function getPrimeGradient(): ?string
  744.     {
  745.         return $this->primeGradient;
  746.     }
  747.     /**
  748.      * @param string|null $primeGradient
  749.      * @return $this
  750.      */
  751.     public function setPrimeGradient(?string $primeGradient): self
  752.     {
  753.         $this->primeGradient $primeGradient;
  754.         return $this;
  755.     }
  756.     /**
  757.      * @param DirectoryItem|null $directoryItem
  758.      * @return $this
  759.      */
  760.     public function setDirectoryItem(?DirectoryItem $directoryItem): self
  761.     {
  762.         $this->directoryItem $directoryItem;
  763.         return $this;
  764.     }
  765.     /**
  766.      * @return DirectoryItem|null
  767.      */
  768.     public function getDirectoryItem(): ?DirectoryItem
  769.     {
  770.         return $this->directoryItem;
  771.     }
  772.     /**
  773.      * @return Collection
  774.      */
  775.     public function getBullet(): Collection
  776.     {
  777.         return $this->bullet ?? new ArrayCollection();
  778.     }
  779.     /**
  780.      * @param Bullet $bullet
  781.      * @return $this
  782.      */
  783.     public function addBullet(Bullet $bullet): self
  784.     {
  785.         $this->bullet[] = $bullet;
  786.         $bullet->setPage($this);
  787.         return $this;
  788.     }
  789.     /**
  790.      * @param Bullet $bullet
  791.      * @return void
  792.      */
  793.     public function removeBullet(Bullet $bullet): void
  794.     {
  795.         $this->bullet->removeElement($bullet);
  796.     }
  797.     /**
  798.      * @param string $path
  799.      * @return $this
  800.      */
  801.     public function setPath(string $path): self
  802.     {
  803.         $this->path $path;
  804.         $pathExpl explode('/'$path);
  805.         $this->setSlug(end($pathExpl));
  806.         return $this;
  807.     }
  808.     /**
  809.      * @return string|null
  810.      */
  811.     public function getMainKeyword(): ?string
  812.     {
  813.         return $this->mainKeyword;
  814.     }
  815.     /**
  816.      * @param string|null $mainKeyword
  817.      * @return $this
  818.      */
  819.     public function setMainKeyword(?string $mainKeyword): self
  820.     {
  821.         $this->mainKeyword $mainKeyword;
  822.         return $this;
  823.     }
  824.     /**
  825.      * @return string|null
  826.      */
  827.     public function getAltKeywords(): ?string
  828.     {
  829.         return $this->altKeywords;
  830.     }
  831.     /**
  832.      * @param string|null $altKeywords
  833.      * @return $this
  834.      */
  835.     public function setAltKeywords(?string $altKeywords): self
  836.     {
  837.         $this->altKeywords $altKeywords;
  838.         return $this;
  839.     }
  840.     /**
  841.      * @return Page|null
  842.      */
  843.     public function getRelatedTo(): ?Page
  844.     {
  845.         return $this->relatedTo;
  846.     }
  847.     /**
  848.      * @param Page|null $relatedTo
  849.      * @return $this
  850.      */
  851.     public function setRelatedTo(?Page $relatedTo): self
  852.     {
  853.         $this->relatedTo $relatedTo;
  854.         return $this;
  855.     }
  856.     /**
  857.      * @return Collection|Page[]
  858.      */
  859.     public function getRelates(): Collection
  860.     {
  861.         return $this->relates;
  862.     }
  863.     /**
  864.      * @param Page $relate
  865.      * @return $this
  866.      */
  867.     public function addRelates(Page $relate): self
  868.     {
  869.         if (!$this->relates->contains($relate)) {
  870.             $this->relates[] = $relate;
  871.             $relate->setRelatedTo($this);
  872.         }
  873.         return $this;
  874.     }
  875.     /**
  876.      * @param Page $relate
  877.      * @return $this
  878.      */
  879.     public function removeRelates(Page $relate): self
  880.     {
  881.         if ($this->relates->contains($relate)) {
  882.             $this->relates->removeElement($relate);
  883.             // set the owning side to null (unless already changed)
  884.             if ($relate->getRelatedTo() === $this) {
  885.                 $relate->setRelatedTo(null);
  886.             }
  887.         }
  888.         return $this;
  889.     }
  890.     /**
  891.      * @return Collection
  892.      */
  893.     public function getPageTags(): Collection
  894.     {
  895.         return $this->pageTags;
  896.     }
  897.     /**
  898.      * @return int
  899.      */
  900.     public function getPageTagsCount(): int
  901.     {
  902.         return $this->pageTags->count();
  903.     }
  904.     /**
  905.      * @return int
  906.      */
  907.     public function getWidgetIntent(): int
  908.     {
  909.         if (!$this->getTemplate()) {
  910.             return 0;
  911.         }
  912.         foreach ($this->getTemplate()->getWidgets() as $widget) {
  913.             if ($widget->getParameter('intentFit')) {
  914.                 return 1;
  915.             }
  916.         }
  917.         return 0;
  918.     }
  919.     /**
  920.      * @param PageTag $pageTag
  921.      * @return $this
  922.      */
  923.     public function addPageTag(PageTag $pageTag): self
  924.     {
  925.         if (!$this->pageTags->contains($pageTag)) {
  926.             $this->pageTags[] = $pageTag;
  927.             $pageTag->setPage($this);
  928.         }
  929.         return $this;
  930.     }
  931.     /**
  932.      * @param PageTag $pageTag
  933.      * @return $this
  934.      */
  935.     public function removePageTag(PageTag $pageTag): self
  936.     {
  937.         if ($this->pageTags->contains($pageTag)) {
  938.             $this->pageTags->removeElement($pageTag);
  939.         }
  940.         return $this;
  941.     }
  942.     /**
  943.      * @return Collection|Ctr[]
  944.      */
  945.     public function getCtr(): Collection
  946.     {
  947.         return $this->ctr;
  948.     }
  949.     /**
  950.      * @param Ctr $ctr
  951.      * @return $this
  952.      */
  953.     public function addCtr(Ctr $ctr): self
  954.     {
  955.         if (!$this->ctr->contains($ctr)) {
  956.             $this->ctr[] = $ctr;
  957.             $ctr->setPage($this);
  958.         }
  959.         return $this;
  960.     }
  961.     /**
  962.      * @param Ctr $ctr
  963.      * @return $this
  964.      */
  965.     public function removeCtr(Ctr $ctr): self
  966.     {
  967.         if ($this->ctr->contains($ctr)) {
  968.             $this->ctr->removeElement($ctr);
  969.         }
  970.         return $this;
  971.     }
  972.     /**
  973.      * Get updated
  974.      *
  975.      * @return DateTime|null
  976.      */
  977.     public function getCtrUpdated():?DateTime
  978.     {
  979.         return $this->ctrUpdated;
  980.     }
  981.     /**
  982.      * @return Locale|null
  983.      */
  984.     public function getHtmlLang(): ?Locale
  985.     {
  986.         return $this->htmlLang;
  987.     }
  988.     /**
  989.      * @param Locale|null $htmlLang
  990.      * @return $this
  991.      */
  992.     public function setHtmlLang(?Locale $htmlLang): self
  993.     {
  994.         $this->htmlLang $htmlLang;
  995.         return $this;
  996.     }
  997.     /**
  998.      * @return Author|null
  999.      */
  1000.     public function getAuthor(): ?Author
  1001.     {
  1002.         return $this->author;
  1003.     }
  1004.     /**
  1005.      * @param Author|null $author
  1006.      * @return $this
  1007.      */
  1008.     public function setAuthor(?Author $author): self
  1009.     {
  1010.         $this->author $author;
  1011.         return $this;
  1012.     }
  1013.     /**
  1014.      * @return Author|null
  1015.      */
  1016.     public function getReviewer(): ?Author
  1017.     {
  1018.         return $this->reviewer;
  1019.     }
  1020.     /**
  1021.      * @param Author|null $reviewer
  1022.      * @return self
  1023.      */
  1024.     public function setReviewer(?Author $reviewer): self
  1025.     {
  1026.         $this->reviewer $reviewer;
  1027.         return $this;
  1028.     }
  1029. }