<?php
namespace Score\CmsBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Score\BaseBundle\Entity\BaseEntity;
/**
* @ORM\Entity
* @ORM\Table(name="cms_menu")
* @ORM\HasLifecycleCallbacks()
*/
class Menu extends BaseEntity {
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(type="string", length=200)
*/
protected $name;
/**
* @ORM\Column(type="string", length=1000 , nullable = true)
*/
protected $link;
/**
* @ORM\Column(type="integer", nullable = true)
*/
protected $parentId;
/**
* @ORM\Column(type="integer", nullable = true)
*/
protected $lvl;
/**
* @ORM\Column(type="integer", nullable = true)
*/
protected $sortOrder;
/**
* @ORM\Column(type="string", nullable = true)
*/
protected $lang;
/**
* @ORM\Column(type="integer", nullable = true)
*/
protected $rootId;
/**
* @ORM\Column(type="string", nullable = true)
*/
protected $linkType;
/**
* @ORM\Column(type="string", nullable = true)
*/
protected $linkTypeData;
/**
* @ORM\OneToMany(targetEntity="\Score\CmsBundle\Entity\Multisite\SiteItemMenu", mappedBy="menu",cascade={"persist","remove"})
*/
private $siteItemMenu = [];
private $multisite;
public function getId()
{
return $this->id;
}
public function getName()
{
return $this->name;
}
public function getLink()
{
return $this->link;
}
public function getParentId()
{
return $this->parentId;
}
public function getLvl()
{
return $this->lvl;
}
public function getSortOrder()
{
return $this->sortOrder;
}
public function getLang()
{
return $this->lang;
}
public function setId($id)
{
$this->id = $id;
}
public function setName($name)
{
$this->name = $name;
}
public function setLink($link)
{
$this->link = $link;
}
public function setParentId($parentId)
{
$this->parentId = $parentId;
}
public function setLvl($lvl)
{
$this->lvl = $lvl;
}
public function setSortOrder($sortOrder)
{
$this->sortOrder = $sortOrder;
}
public function setLang($lang)
{
$this->lang = $lang;
}
public function getRootId()
{
return $this->rootId;
}
public function setRootId($rootId)
{
$this->rootId = $rootId;
}
public function getLinkType()
{
return $this->linkType;
}
public function getLinkTypeData()
{
return $this->linkTypeData;
}
public function setLinkType($linkType)
{
$this->linkType = $linkType;
}
public function setLinkTypeData($linkTypeData)
{
$this->linkTypeData = $linkTypeData;
}
public function getLinkTypeId()
{
if ('page' == $this->getLinkType())
{
$data = json_decode($this->getLinkTypeData(),true);
return $data['id'];
}
else
{
return null;
}
}
public function getPublicLink()
{
if ('page' == $this->getLinkType())
{
//return $this->getLink();
$routeInfo = json_decode($this->getLinkTypeData(),true);
return $routeInfo['seoId'];
}
else
{
return $this->getLink();
}
}
/**
* Get the value of siteItemMenu
*/
public function getSiteItemMenu()
{
return $this->siteItemMenu;
}
/**
* Set the value of siteItemMenu
*
* @return self
*/
public function setSiteItemMenu($siteItemMenu)
{
$this->siteItemMenu = $siteItemMenu;
return $this;
}
}