<?php
/**
* Created by PhpStorm.
* User: lisavandaele
* Date: 30/01/15
* Time: 12:53
*/
namespace Notaris\AdminBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity(repositoryClass="SubsiteModuleRepository")
* @ORM\Table(name="subsite_module")
*/
class SubsiteModule {
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity="Notaris\AdminBundle\Entity\Subsite")
* @ORM\JoinColumn(name="subsite_id", referencedColumnName="id", onDelete="CASCADE")
*/
private $subsite;
/**
* @ORM\Column(name="position", type="string", columnDefinition="enum('CENTER', 'RIGHT')", nullable=true)
*/
private $position = 'CENTER';
/**
* @var integer
*
* @ORM\Column(type="integer")
*/
private $position_num = 0;
/**
* @var string
*
* @ORM\Column(name="title", type="string", length=255, nullable=true)
*/
private $title;
/**
* @ORM\Column(type="text", name="text")
*/
private $text;
/**
* @Gedmo\Timestampable(on="create")
* @ORM\Column(name="created", type="datetime")
*/
private $created;
/**
* @ORM\Column(name="updated", type="datetime")
* @Gedmo\Timestampable(on="update")
*/
private $updated;
/**
* @ORM\Column(type="boolean", name="is_active")
* @Assert\Type("boolean")
*/
private $isActive;
/**
* @ORM\Column(name="pub_date", type="datetime")
*/
private $publicationDate;
/**
* @ORM\ManyToOne(targetEntity="Notaris\AdminBundle\Entity\User")
* @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="SET NULL")
*/
private $user;
/**
* @ORM\OneToOne(targetEntity="Asset")
* @ORM\JoinColumn(name="asset_id", referencedColumnName="id")
*/
protected $asset;
/**
* @Gedmo\Slug(fields={"title"})
* @ORM\Column(length=128, unique=true)
*/
private $slug;
/**
* @var string
*
* @ORM\Column(name="locale", type="string", length=5)
*/
private $locale;
/**
* Constructor
*/
public function __construct()
{
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set place
*
* @param string $place
* @return SubsiteModule
*/
public function setPlace($place)
{
$this->place = $place;
return $this;
}
/**
* Get place
*
* @return string
*/
public function getPlace()
{
return $this->place;
}
/**
* Set title
*
* @param string $title
* @return SubsiteModule
*/
public function setTitle($title)
{
$this->title = $title;
return $this;
}
/**
* Get title
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* Set text
*
* @param string $text
* @return SubsiteModule
*/
public function setText($text)
{
$this->text = $text;
return $this;
}
/**
* Get text
*
* @return string
*/
public function getText()
{
return $this->text;
}
/**
* Get text's first line
*
* @return string
*/
public function getTextFirstLine()
{
return html_entity_decode(strip_tags(mb_substr($this->text , 0, mb_strpos($this->text, '</p>'))));
}
/**
* Set created
*
* @param \DateTime $created
* @return SubsiteModule
*/
public function setCreated($created)
{
$this->created = $created;
return $this;
}
/**
* Get created
*
* @return \DateTime
*/
public function getCreated()
{
return $this->created;
}
/**
* Set updated
*
* @param \DateTime $updated
* @return SubsiteModule
*/
public function setUpdated($updated)
{
$this->updated = $updated;
return $this;
}
/**
* Get updated
*
* @return \DateTime
*/
public function getUpdated()
{
return $this->updated;
}
/**
* Set publicationDate
*
* @param \DateTime $publicationDate
* @return SubsiteModule
*/
public function setPublicationDate($publicationDate)
{
$this->publicationDate = $publicationDate;
return $this;
}
/**
* Get publicationDate
*
* @return \DateTime
*/
public function getPublicationDate()
{
return $this->publicationDate;
}
/**
* Set subsite
*
* @param \Notaris\AdminBundle\Entity\Subsite $subsite
* @return SubsiteModule
*/
public function setSubsite(\Notaris\AdminBundle\Entity\Subsite $subsite = null)
{
$this->subsite = $subsite;
return $this;
}
/**
* Get subsite
*
* @return \Notaris\AdminBundle\Entity\Subsite
*/
public function getSubsite()
{
return $this->subsite;
}
/**
* Set user
*
* @param \Notaris\AdminBundle\Entity\User $user
* @return SubsiteModule
*/
public function setUser(\Notaris\AdminBundle\Entity\User $user = null)
{
$this->user = $user;
return $this;
}
/**
* Get user
*
* @return \Notaris\AdminBundle\Entity\User
*/
public function getUser()
{
return $this->user;
}
/**
* Set isActive
*
* @param boolean $isActive
* @return SubsiteModule
*/
public function setIsActive($isActive)
{
$this->isActive = $isActive;
return $this;
}
/**
* Get isActive
*
* @return boolean
*/
public function getIsActive()
{
return $this->isActive;
}
/**
* Set asset
*
* @param \Notaris\AdminBundle\Entity\Asset $asset
* @return SubsiteModule
*/
public function setAsset(\Notaris\AdminBundle\Entity\Asset $asset = null)
{
$this->asset = $asset;
return $this;
}
/**
* Get asset
*
* @return \Notaris\AdminBundle\Entity\Asset
*/
public function getAsset()
{
return $this->asset;
}
/**
* Set position
*
* @param string $position
* @return SubsiteModule
*/
public function setPosition($position)
{
$this->position = $position;
return $this;
}
/**
* Get position
*
* @return string
*/
public function getPosition()
{
return $this->position;
}
/**
* Set position_num
*
* @param integer $positionNum
* @return SubsiteModule
*/
public function setPositionNum($positionNum)
{
$this->position_num = $positionNum;
return $this;
}
/**
* Get position_num
*
* @return integer
*/
public function getPositionNum()
{
return $this->position_num;
}
/**
* Set slug
*
* @param string $slug
* @return SubsiteModule
*/
public function setSlug($slug)
{
$this->slug = $slug;
return $this;
}
/**
* Get slug
*
* @return string
*/
public function getSlug()
{
return $this->slug;
}
/**
* Set locale
*
* @param string $locale
* @return SubsiteModule
*/
public function setLocale($locale)
{
$this->locale = $locale;
return $this;
}
/**
* Get locale
*
* @return string
*/
public function getLocale()
{
return $this->locale;
}
/**
* Get position options
*
* @return array
*/
public function getPositionOptions()
{
return array(
'CENTER'=>'CENTER',
'RIGHT'=>'RIGHT'
);
}
}