src/Entity/OmeloPage.php line 10

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Symfony\Component\Serializer\Annotation\Groups;
  4. use Doctrine\ORM\Mapping as ORM;
  5. /**
  6.  * @ORM\Entity(repositoryClass="App\Repository\OmeloPageRepository")
  7.  */
  8. class OmeloPage
  9. {
  10.     /**
  11.      * @ORM\Id()
  12.      * @ORM\GeneratedValue()
  13.      * @ORM\Column(type="integer")
  14.      */
  15.     private $id;
  16.     /**
  17.      * @ORM\Column(type="string", length=255)
  18.      */
  19.     private $url;
  20.     /**
  21.      * @ORM\Column(type="string", length=5)
  22.      */
  23.     private $lang;
  24.     /**
  25.      * @ORM\Column(type="text", nullable=true)
  26.      */
  27.     private $javascript;
  28.     /**
  29.      * @ORM\Column(type="text", nullable=true)
  30.      */
  31.     private $stylesheet;
  32.     /**
  33.      * @ORM\Column(type="string", length=255, nullable=true)
  34.      */
  35.     private $template;
  36.     /**
  37.      * @ORM\Column(type="text", nullable=true)
  38.      */
  39.     private $content;
  40.     /**
  41.      * @ORM\Column(type="string", length=1, nullable=true)
  42.      * not used fix a bug in admin
  43.      */
  44.     private $mainContent;
  45.     /**
  46.      * @ORM\Column(type="string", length=100, nullable=true)
  47.      */
  48.     private $metaTitle;
  49.     /**
  50.      * @ORM\Column(type="string", length=200, nullable=true)
  51.      */
  52.     private $metaDescription;
  53.     public function getId(): ?int
  54.     {
  55.         return $this->id;
  56.     }
  57.     public function getUrl(): ?string
  58.     {
  59.         return $this->url;
  60.     }
  61.     public function setUrl(string $url): self
  62.     {
  63.         $this->url $url;
  64.         return $this;
  65.     }
  66.     public function getLang(): ?string
  67.     {
  68.         return $this->lang;
  69.     }
  70.     public function setLang(string $lang): self
  71.     {
  72.         $this->lang $lang;
  73.         return $this;
  74.     }
  75.     public function getLayers(): ?string
  76.     {
  77.         $content $this->getContentInJson();
  78.         if(!empty($content['panelList']))
  79.             return $content['panelList'];
  80.         else
  81.             return '';
  82.     }
  83.     public function setLayers($layers): self
  84.     {
  85.         return $this;
  86.     }
  87.     public function getMainContent(): ?string
  88.     {
  89.        $content $this->getContentInJson();
  90.        if(isset($content['custom']) && !empty(trim($content['custom']))){
  91.            return $content['custom'];
  92.        }elseif (isset($content['mainContent']))
  93.            return $content['mainContent'];
  94.        else
  95.             return '';
  96.     }
  97.     public function setMainContent(?string $mainContent): self
  98.     {
  99.        $content $this->getContentInJson();
  100.        $content['custom'] = $mainContent;
  101.        $this->setContent(json_encode($contenttrue));
  102.        return $this;
  103.     }
  104.     public function getJavascript(): ?string
  105.     {
  106.         return $this->javascript;
  107.     }
  108.     public function setJavascript(?string $javascript): self
  109.     {
  110.         $this->javascript $javascript;
  111.         return $this;
  112.     }
  113.     public function getStylesheet(): ?string
  114.     {
  115.         return $this->stylesheet;
  116.     }
  117.     public function setStylesheet(?string $stylesheet): self
  118.     {
  119.         $this->stylesheet $stylesheet;
  120.         return $this;
  121.     }
  122.     public function getTemplate(): ?string
  123.     {
  124.         return $this->template;
  125.     }
  126.     public function setTemplate(?string $template): self
  127.     {
  128.         $this->template $template;
  129.         return $this;
  130.     }
  131.     public function getContent()
  132.     {
  133.         return $this->content;
  134.     }
  135.     public function getContentInJson(){
  136.         if(!empty($this->getContent())){
  137.             //Let's replace all images by optimized one
  138.             $json trim(trim($this->getContent(), '"'), "'");
  139.             $contents json_decode($jsontrue);
  140.             return $contents;
  141.         }
  142.     }
  143.     public function setContent($content): self
  144.     {
  145.         $this->content $content;
  146.         return $this;
  147.     }
  148.     public function getMetaTitle(): ?string
  149.     {
  150.         return $this->metaTitle;
  151.     }
  152.     public function setMetaTitle(?string $metaTitle): self
  153.     {
  154.         $this->metaTitle $metaTitle;
  155.         return $this;
  156.     }
  157.     public function getMetaDescription(): ?string
  158.     {
  159.         return $this->metaDescription;
  160.     }
  161.     public function setMetaDescription($metaDescription): self
  162.     {
  163.         $this->metaDescription $metaDescription;
  164.         return $this;
  165.     }
  166.     public function __toString(){
  167.         return 'Page '.$this->url;
  168.     }
  169. }