<?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="SectionParagraphRepository")
* @ORM\Table(name="section_paragraph")
*/
class SectionParagraph {
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @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\ManyToOne(targetEntity="Notaris\AdminBundle\Entity\User")
* @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="SET NULL")
*/
private $user;
/**
* @ORM\ManyToOne(targetEntity="Notaris\AdminBundle\Entity\Section", inversedBy="paragraphs")
* @ORM\JoinColumn(name="section_id", referencedColumnName="id", onDelete="CASCADE")
*/
private $section;
/**
* @var integer
*
* @ORM\Column(type="integer")
*/
private $position = 0;
/**
* @var integer
*
* @ORM\Column(type="integer")
*/
private $type = 0;
/**
* @var integer
*
* @ORM\Column(type="integer")
*/
private $accordionStatus = 0;
/**
* @var string
*
* @ORM\Column(name="title", type="text")
*/
private $title;
/**
* @var string
*
* @ORM\Column(name="subtitle", type="text")
*/
private $subtitle;
/**
* @ORM\Column(type="text", name="description")
*/
private $description;
/**
* @ORM\OneToOne(targetEntity="Asset")
* @ORM\JoinColumn(name="asset_id", referencedColumnName="id")
*/
protected $asset;
/**
* @ORM\Column(type="boolean", name="is_active")
* @Assert\Type("boolean")
*/
private $isActive;
/**
* @ORM\Column(name="pub_date", type="datetime")
*/
private $publicationDate;
/**
* @var string
*
* @ORM\Column(name="locale", type="string", length=5)
*/
private $locale;
// /**
// * @ORM\OneToOne(targetEntity="Video")
// * @ORM\JoinColumn(name="video_id", referencedColumnName="id")
// */
// private $video;
//
// /**
// * @ORM\Column(type="boolean", name="is_youtube")
// * @Assert\Type("boolean")
// */
// private $isYoutube;
/**
* Constructor
*/
public function __construct()
{
}
/**
* @return string
*/
public function __toString(){
if($this->getTitle()) {
return $this->getTitle();
}
if($this->getSubtitle()) {
return $this->getSubtitle();
}
if($this->getDescription()) {
return strip_tags($this->getDescription());
}
return 'None';
}
/**
* @return string
*/
public function getRenderStatus()
{
if ($this->getIsActive()) {
$now = new \DateTime('now');
$date = $this->getPublicationDate();
if ($date <= $now) {
return '<span class="label label-success">ON</span>';
}
return '<span class="label label-warning">...</span>';
}
return '<span class="label label-danger">OFF</span>';
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set created
*
* @param \DateTime $created
* @return SectionParagraph
*/
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 SectionParagraph
*/
public function setUpdated($updated)
{
$this->updated = $updated;
return $this;
}
/**
* Get updated
*
* @return \DateTime
*/
public function getUpdated()
{
return $this->updated;
}
/**
* Set position
*
* @param integer $position
* @return SectionParagraph
*/
public function setPosition($position)
{
$this->position = $position;
return $this;
}
/**
* Get position
*
* @return integer
*/
public function getPosition()
{
return $this->position;
}
/**
* Set type
*
* @param integer $type
* @return SectionParagraph
*/
public function setType($type)
{
$this->type = $type;
return $this;
}
/**
* Get type
*
* @return integer
*/
public function getType()
{
return $this->type;
}
/**
* Set accordion status
*
* @param integer $accordionStatus
* @return SectionParagraph
*/
public function setAccordionStatus($accordionStatus)
{
$this->accordionStatus = $accordionStatus;
return $this;
}
/**
* Get accordion status
*
* @return integer
*/
public function getAccordionStatus()
{
return $this->accordionStatus;
}
/**
* Set title
*
* @param string $title
* @return SectionParagraph
*/
public function setTitle($title)
{
$this->title = $title;
return $this;
}
/**
* Get title
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* Set subtitle
*
* @param string $subtitle
* @return SectionParagraph
*/
public function setSubtitle($subtitle)
{
$this->subtitle = $subtitle;
return $this;
}
/**
* Get subtitle
*
* @return string
*/
public function getSubtitle()
{
return $this->subtitle;
}
/**
* Set description
*
* @param string $description
* @return SectionParagraph
*/
public function setDescription($description)
{
$this->description = $description;
return $this;
}
/**
* Get description
*
* @return string
*/
public function getDescription()
{
return $this->description;
}
/**
* Set publicationDate
*
* @param \DateTime $publicationDate
* @return SectionParagraph
*/
public function setPublicationDate($publicationDate)
{
$this->publicationDate = $publicationDate;
return $this;
}
/**
* Get publicationDate
*
* @return \DateTime
*/
public function getPublicationDate()
{
return $this->publicationDate;
}
/**
* Set user
*
* @param \Notaris\AdminBundle\Entity\User $user
* @return SectionParagraph
*/
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 section
*
* @param \Notaris\AdminBundle\Entity\Section $section
* @return SectionParagraph
*/
public function setSection(\Notaris\AdminBundle\Entity\Section $section = null)
{
$this->section = $section;
return $this;
}
/**
* Get section
*
* @return \Notaris\AdminBundle\Entity\Section
*/
public function getSection()
{
return $this->section;
}
/**
* Set isActive
*
* @param boolean $isActive
* @return SectionParagraph
*/
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 SectionParagraph
*/
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 locale
*
* @param string $locale
* @return SectionParagraph
*/
public function setLocale($locale)
{
$this->locale = $locale;
return $this;
}
/**
* Get locale
*
* @return string
*/
public function getLocale()
{
return $this->locale;
}
// /**
// * Set video
// *
// * @param \Notaris\AdminBundle\Entity\Video $video
// * @return SectionParagraph
// */
// public function setVideo(\Notaris\AdminBundle\Entity\Video $video = null)
// {
// $this->video = $video;
//
// return $this;
// }
//
// /**
// * Get video
// *
// * @return \Notaris\AdminBundle\Entity\Video
// */
// public function getVideo()
// {
// return $this->video;
// }
// /**
// * Set isYoutube
// *
// * @param boolean $isYoutube
// * @return SectionParagraph
// */
// public function setIsYoutube($isYoutube)
// {
// $this->isYoutube = $isYoutube;
//
// return $this;
// }
//
// /**
// * Get isYoutube
// *
// * @return boolean
// */
// public function getIsYoutube()
// {
// return $this->isYoutube;
// }
}