<?php
namespace Uniski\CMSBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* @ORM\Entity
* @ORM\Table("page")
*/
class Page
{
/**
* @var integer
*
* @ORM\Id
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
protected $id;
/**
* @var Uniski\ResourceBundle\Entity\Image
* @ORM\ManyToOne(targetEntity="Uniski\ResourceBundle\Entity\Image", cascade={"persist"})
* @ORM\JoinColumn(name="image_id", referencedColumnName="id", nullable=true)
*/
protected $image;
/**
* @var string
* @ORM\Column(name="title", type="string")
*/
protected $title;
/**
* @var string
* @ORM\Column(name="body", type="text")
*/
protected $body;
/**
* @var \DateTime
* @ORM\Column(name="created", type="datetime")
*/
protected $created;
/**
* @Gedmo\Slug(fields={"title"})
* @ORM\Column(length=128, unique=true)
*/
private $slug;
/**
* @ORM\Column(length=128, nullable=true)
*/
private $prefix;
/**
* @var array
* @ORM\Column(type="json")
*/
protected $seo;
/**
* @var array
* @ORM\Column(type="json")
*/
protected $config;
/**
* @var ArrayCollection
* @ORM\OneToMany(targetEntity="Offer", mappedBy="page")
*/
protected $offers;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set title
*
* @param string $title
*
* @return Post
*/
public function setTitle($title)
{
$this->title = $title;
return $this;
}
/**
* Get title
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* Set body
*
* @param string $body
*
* @return Post
*/
public function setBody($body)
{
$this->body = $body;
return $this;
}
/**
* Get body
*
* @return string
*/
public function getBody()
{
return $this->body;
}
/**
* Set created
*
* @param \DateTime $created
*
* @return Post
*/
public function setCreated($created)
{
$this->created = $created;
return $this;
}
/**
* Get created
*
* @return \DateTime
*/
public function getCreated()
{
return $this->created;
}
/**
* Set slug
*
* @param string $slug
*
* @return Post
*/
public function setSlug($slug)
{
$this->slug = $slug;
return $this;
}
/**
* Get slug
*
* @return string
*/
public function getSlug()
{
return $this->slug;
}
/**
* Set seo
*
* @param array $seo
*
* @return Post
*/
public function setSeo($seo)
{
$this->seo = $seo;
return $this;
}
/**
* Get seo
*
* @return array
*/
public function getSeo()
{
return $this->seo;
}
/**
* Set image
*
* @param \Uniski\ResourceBundle\Entity\Image $image
*
* @return Post
*/
public function setImage(\Uniski\ResourceBundle\Entity\Image $image = null)
{
$this->image = $image;
return $this;
}
/**
* Get image
*
* @return \Uniski\ResourceBundle\Entity\Image
*/
public function getImage()
{
return $this->image;
}
/**
* Constructor
*/
public function __construct()
{
$this->tags = new \Doctrine\Common\Collections\ArrayCollection();
$this->created = new \DateTime();
}
/**
* Add offer
*
* @param \Uniski\CMSBundle\Entity\Offer $offer
*
* @return Page
*/
public function addOffer(\Uniski\CMSBundle\Entity\Offer $offer)
{
$this->offers[] = $offer;
return $this;
}
/**
* Remove offer
*
* @param \Uniski\CMSBundle\Entity\Offer $offer
*/
public function removeOffer(\Uniski\CMSBundle\Entity\Offer $offer)
{
$this->offers->removeElement($offer);
}
/**
* Get offers
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getOffers()
{
return $this->offers;
}
/**
* Gets the value of config.
*
* @return array
*/
public function getConfig()
{
return $this->config;
}
/**
* Sets the value of config.
*
* @param array $config the config
*
* @return self
*/
public function setConfig($config)
{
$this->config = $config;
return $this;
}
public function getWebForm()
{
if ($this->config && isset($this->config['webform'])) return $this->config['webform'];
return null;
}
/**
* @return mixed
*/
public function getPrefix()
{
return $this->prefix;
}
/**
* @param mixed $prefix
*
* @return self
*/
public function setPrefix($prefix)
{
$this->prefix = $prefix;
return $this;
}
}