vendor/score/cms/src/Entity/Block/Block.php line 17

Open in your IDE?
  1. <?php
  2. namespace Score\CmsBundle\Entity\Block;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Score\BaseBundle\Entity\BaseEntity;
  6. use Score\CmsBundle\Repository\BlockRepository;
  7. /**
  8.  * Block
  9.  * @ORM\Entity(repositoryClass=BlockRepository::class)
  10.  * @ORM\Table(name="cms_block")
  11.  * @ORM\HasLifecycleCallbacks()
  12.  */
  13. class Block extends BaseEntity {
  14.     /**
  15.      * @var string
  16.      *
  17.      * @ORM\Column(name="name", type="string", length=100, nullable=false)
  18.      */
  19.     private $name;
  20.     /**
  21.      * @var string
  22.      *
  23.      * @ORM\Column(name="perex", type="text", nullable=true)
  24.      */
  25.     private $perex;
  26.     /**
  27.      * @var string
  28.      *
  29.      * @ORM\Column(name="content", type="text", nullable=true)
  30.      */
  31.     private $content;
  32.     /**
  33.      * @var string
  34.      *
  35.      * @ORM\Column(name="lang", type="string", length=50, nullable=true)
  36.      */
  37.     private $lang;
  38.     /**
  39.      * @var string
  40.      *
  41.      * @ORM\Column(name="module", type="string", length=200, nullable=true)
  42.      */
  43.     private $module;
  44.     /**
  45.      * @var string
  46.      *
  47.      * @ORM\Column(name="action", type="string", length=200, nullable=true)
  48.      */
  49.     private $action;
  50.     /**
  51.      * @var string
  52.      *
  53.      * @ORM\Column(name="params", type="text", nullable=true)
  54.      */
  55.     private $params;
  56.     /**
  57.      * @var string
  58.      *
  59.      * @ORM\Column(name="type", type="string", length=200, nullable=true)
  60.      */
  61.     private $type;
  62.     /**
  63.      * @var integer
  64.      *
  65.      * @ORM\Column(name="sort_order", type="integer", nullable=true)
  66.      */
  67.     private $sortOrder;
  68.     /**
  69.      * @ORM\OneToMany(targetEntity="Score\CmsBundle\Entity\Page\PageBlock", mappedBy="block")
  70.      */
  71.     private $pageBlocks;
  72.      /**
  73.      * @var string
  74.      *
  75.      * @ORM\Column(name="description", type="text", nullable=true)
  76.      */
  77.     private $description;
  78.     /**
  79.      * Set name
  80.      *
  81.      * @param string $name
  82.      * @return Block
  83.      */
  84.     public function setName($name)
  85.     {
  86.         $this->name $name;
  87.         return $this;
  88.     }
  89.     /**
  90.      * Get name
  91.      *
  92.      * @return string
  93.      */
  94.     public function getName()
  95.     {
  96.         return $this->name;
  97.     }
  98.     /**
  99.      * Set perex
  100.      *
  101.      * @param string $perex
  102.      * @return Block
  103.      */
  104.     public function setPerex($perex)
  105.     {
  106.         $this->perex $perex;
  107.         return $this;
  108.     }
  109.     /**
  110.      * Get perex
  111.      *
  112.      * @return string
  113.      */
  114.     public function getPerex()
  115.     {
  116.         return $this->perex;
  117.     }
  118.     /**
  119.      * Set content
  120.      *
  121.      * @param string $content
  122.      * @return Block
  123.      */
  124.     public function setContent($content)
  125.     {
  126.         $this->content $content;
  127.         return $this;
  128.     }
  129.     /**
  130.      * Get content
  131.      *
  132.      * @return string
  133.      */
  134.     public function getContent()
  135.     {
  136.         return $this->content;
  137.     }
  138.     /**
  139.      * Set lang
  140.      *
  141.      * @param string $lang
  142.      * @return Block
  143.      */
  144.     public function setLang($lang)
  145.     {
  146.         $this->lang $lang;
  147.         return $this;
  148.     }
  149.     /**
  150.      * Get lang
  151.      *
  152.      * @return string
  153.      */
  154.     public function getLang()
  155.     {
  156.         return $this->lang;
  157.     }
  158.     /**
  159.      * Set module
  160.      *
  161.      * @param string $module
  162.      * @return Block
  163.      */
  164.     public function setModule($module)
  165.     {
  166.         $this->module $module;
  167.         return $this;
  168.     }
  169.     /**
  170.      * Get module
  171.      *
  172.      * @return string
  173.      */
  174.     public function getModule()
  175.     {
  176.         return $this->module;
  177.     }
  178.     /**
  179.      * Set action
  180.      *
  181.      * @param string $action
  182.      * @return Block
  183.      */
  184.     public function setAction($action)
  185.     {
  186.         $this->action $action;
  187.         return $this;
  188.     }
  189.     /**
  190.      * Get action
  191.      *
  192.      * @return string
  193.      */
  194.     public function getAction()
  195.     {
  196.         return $this->action;
  197.     }
  198.     /**
  199.      * Set params
  200.      *
  201.      * @param string $params
  202.      * @return Block
  203.      */
  204.     public function setParams($params)
  205.     {
  206.         $this->params $params;
  207.         return $this;
  208.     }
  209.     /**
  210.      * Get params
  211.      *
  212.      * @return string
  213.      */
  214.     public function getParams()
  215.     {
  216.         return $this->params;
  217.     }
  218.     public function setParamsArr($params)
  219.     {
  220.         $this->params json_encode($params);
  221.         return $this;
  222.     }
  223.     public function getParamsArr()
  224.     {
  225.         return json_decode($this->paramstrue);
  226.     }
  227.     /**
  228.      * Set type
  229.      *
  230.      * @param string $type
  231.      * @return Block
  232.      */
  233.     public function setType($type)
  234.     {
  235.         $this->type $type;
  236.         return $this;
  237.     }
  238.     /**
  239.      * Get type
  240.      *
  241.      * @return string
  242.      */
  243.     public function getType()
  244.     {
  245.         return $this->type;
  246.     }
  247.     /**
  248.      * Set sortOrder
  249.      *
  250.      * @param integer $sortOrder
  251.      * @return Block
  252.      */
  253.     public function setSortOrder($sortOrder)
  254.     {
  255.         $this->sortOrder $sortOrder;
  256.         return $this;
  257.     }
  258.     /**
  259.      * Get sortOrder
  260.      *
  261.      * @return integer
  262.      */
  263.     public function getSortOrder()
  264.     {
  265.         return $this->sortOrder;
  266.     }
  267.     /**
  268.      * Constructor
  269.      */
  270.     public function __construct()
  271.     {
  272.         $this->pageBlocks = new ArrayCollection();
  273.     }
  274.     function getPageBlocks()
  275.     {
  276.         return $this->pageBlocks;
  277.     }
  278.     function setPageBlocks($pageBlocks)
  279.     {
  280.         $this->pageBlocks $pageBlocks;
  281.     }
  282.     public function getMenuId()
  283.     {
  284.         $params $this->getParams();
  285.         $settings json_decode($params,true);
  286.        return $settings['menuId'];
  287.     }
  288.     /**
  289.      * Get the value of description
  290.      *
  291.      * @return  string
  292.      */ 
  293.     public function getDescription()
  294.     {
  295.         return $this->description;
  296.     }
  297.     /**
  298.      * Set the value of description
  299.      *
  300.      * @param  string  $description
  301.      *
  302.      * @return  self
  303.      */ 
  304.     public function setDescription(string $description)
  305.     {
  306.         $this->description $description;
  307.         return $this;
  308.     }
  309. }