src/Notaris/AdminBundle/Entity/SubsiteModule.php line 19

Open in your IDE?
  1. <?php
  2. /**
  3.  * Created by PhpStorm.
  4.  * User: lisavandaele
  5.  * Date: 30/01/15
  6.  * Time: 12:53
  7.  */
  8. namespace Notaris\AdminBundle\Entity;
  9. use Doctrine\ORM\Mapping as ORM;
  10. use Gedmo\Mapping\Annotation as Gedmo;
  11. use Symfony\Component\Validator\Constraints as Assert;
  12. /**
  13.  * @ORM\Entity(repositoryClass="SubsiteModuleRepository")
  14.  * @ORM\Table(name="subsite_module")
  15.  */
  16. class SubsiteModule {
  17.     /**
  18.      * @var integer
  19.      *
  20.      * @ORM\Column(name="id", type="integer")
  21.      * @ORM\Id
  22.      * @ORM\GeneratedValue(strategy="AUTO")
  23.      */
  24.     private $id;
  25.     /**
  26.      * @ORM\ManyToOne(targetEntity="Notaris\AdminBundle\Entity\Subsite")
  27.      * @ORM\JoinColumn(name="subsite_id", referencedColumnName="id", onDelete="CASCADE")
  28.      */
  29.     private $subsite;
  30.     /**
  31.      * @ORM\Column(name="position", type="string", columnDefinition="enum('CENTER', 'RIGHT')", nullable=true)
  32.      */
  33.     private $position = 'CENTER';
  34.     /**
  35.      * @var integer
  36.      *
  37.      * @ORM\Column(type="integer")
  38.      */
  39.     private $position_num = 0;
  40.     
  41.     /**
  42.      * @var string
  43.      *
  44.      * @ORM\Column(name="title", type="string", length=255, nullable=true)
  45.      */
  46.     private $title;
  47.     /**
  48.      * @ORM\Column(type="text", name="text")
  49.      */
  50.     private $text;
  51.     /**
  52.      * @Gedmo\Timestampable(on="create")
  53.      * @ORM\Column(name="created", type="datetime")
  54.      */
  55.     private $created;
  56.     /**
  57.      * @ORM\Column(name="updated", type="datetime")
  58.      * @Gedmo\Timestampable(on="update")
  59.      */
  60.     private $updated;
  61.     
  62.     /**
  63.      * @ORM\Column(type="boolean", name="is_active")
  64.      * @Assert\Type("boolean")
  65.      */
  66.     private $isActive;
  67.     /**
  68.      * @ORM\Column(name="pub_date", type="datetime")
  69.      */
  70.     private $publicationDate;
  71.     /**
  72.      * @ORM\ManyToOne(targetEntity="Notaris\AdminBundle\Entity\User")
  73.      * @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="SET NULL")
  74.      */
  75.     private $user;
  76.     /**
  77.      * @ORM\OneToOne(targetEntity="Asset")
  78.      * @ORM\JoinColumn(name="asset_id", referencedColumnName="id")
  79.      */
  80.     protected $asset;
  81.     /**
  82.      * @Gedmo\Slug(fields={"title"})
  83.      * @ORM\Column(length=128, unique=true)
  84.      */
  85.     private $slug;
  86.     /**
  87.      * @var string
  88.      *
  89.      * @ORM\Column(name="locale", type="string", length=5)
  90.      */
  91.     private $locale;
  92.     
  93.     /**
  94.      * Constructor
  95.      */
  96.     public function __construct()
  97.     {
  98.     }
  99.     /**
  100.      * Get id
  101.      *
  102.      * @return integer 
  103.      */
  104.     public function getId()
  105.     {
  106.         return $this->id;
  107.     }
  108.     /**
  109.      * Set place
  110.      *
  111.      * @param string $place
  112.      * @return SubsiteModule
  113.      */
  114.     public function setPlace($place)
  115.     {
  116.         $this->place = $place;
  117.         return $this;
  118.     }
  119.     /**
  120.      * Get place
  121.      *
  122.      * @return string 
  123.      */
  124.     public function getPlace()
  125.     {
  126.         return $this->place;
  127.     }
  128.     /**
  129.      * Set title
  130.      *
  131.      * @param string $title
  132.      * @return SubsiteModule
  133.      */
  134.     public function setTitle($title)
  135.     {
  136.         $this->title = $title;
  137.         return $this;
  138.     }
  139.     /**
  140.      * Get title
  141.      *
  142.      * @return string 
  143.      */
  144.     public function getTitle()
  145.     {
  146.         return $this->title;
  147.     }
  148.     /**
  149.      * Set text
  150.      *
  151.      * @param string $text
  152.      * @return SubsiteModule
  153.      */
  154.     public function setText($text)
  155.     {
  156.         $this->text = $text;
  157.         return $this;
  158.     }
  159.     /**
  160.      * Get text
  161.      *
  162.      * @return string 
  163.      */
  164.     public function getText()
  165.     {
  166.         return $this->text;
  167.     }
  168.     
  169.     /**
  170.      * Get text's first line
  171.      *
  172.      * @return string 
  173.      */
  174.     public function getTextFirstLine()
  175.     {
  176.         return html_entity_decode(strip_tags(mb_substr($this->text , 0, mb_strpos($this->text, '</p>'))));
  177.     }
  178.     /**
  179.      * Set created
  180.      *
  181.      * @param \DateTime $created
  182.      * @return SubsiteModule
  183.      */
  184.     public function setCreated($created)
  185.     {
  186.         $this->created = $created;
  187.         return $this;
  188.     }
  189.     /**
  190.      * Get created
  191.      *
  192.      * @return \DateTime 
  193.      */
  194.     public function getCreated()
  195.     {
  196.         return $this->created;
  197.     }
  198.     /**
  199.      * Set updated
  200.      *
  201.      * @param \DateTime $updated
  202.      * @return SubsiteModule
  203.      */
  204.     public function setUpdated($updated)
  205.     {
  206.         $this->updated = $updated;
  207.         return $this;
  208.     }
  209.     /**
  210.      * Get updated
  211.      *
  212.      * @return \DateTime 
  213.      */
  214.     public function getUpdated()
  215.     {
  216.         return $this->updated;
  217.     }
  218.     /**
  219.      * Set publicationDate
  220.      *
  221.      * @param \DateTime $publicationDate
  222.      * @return SubsiteModule
  223.      */
  224.     public function setPublicationDate($publicationDate)
  225.     {
  226.         $this->publicationDate = $publicationDate;
  227.         return $this;
  228.     }
  229.     /**
  230.      * Get publicationDate
  231.      *
  232.      * @return \DateTime 
  233.      */
  234.     public function getPublicationDate()
  235.     {
  236.         return $this->publicationDate;
  237.     }
  238.     /**
  239.      * Set subsite
  240.      *
  241.      * @param \Notaris\AdminBundle\Entity\Subsite $subsite
  242.      * @return SubsiteModule
  243.      */
  244.     public function setSubsite(\Notaris\AdminBundle\Entity\Subsite $subsite = null)
  245.     {
  246.         $this->subsite = $subsite;
  247.         return $this;
  248.     }
  249.     /**
  250.      * Get subsite
  251.      *
  252.      * @return \Notaris\AdminBundle\Entity\Subsite 
  253.      */
  254.     public function getSubsite()
  255.     {
  256.         return $this->subsite;
  257.     }
  258.     /**
  259.      * Set user
  260.      *
  261.      * @param \Notaris\AdminBundle\Entity\User $user
  262.      * @return SubsiteModule
  263.      */
  264.     public function setUser(\Notaris\AdminBundle\Entity\User $user = null)
  265.     {
  266.         $this->user = $user;
  267.         return $this;
  268.     }
  269.     /**
  270.      * Get user
  271.      *
  272.      * @return \Notaris\AdminBundle\Entity\User 
  273.      */
  274.     public function getUser()
  275.     {
  276.         return $this->user;
  277.     }
  278.     /**
  279.      * Set isActive
  280.      *
  281.      * @param boolean $isActive
  282.      * @return SubsiteModule
  283.      */
  284.     public function setIsActive($isActive)
  285.     {
  286.         $this->isActive = $isActive;
  287.         return $this;
  288.     }
  289.     /**
  290.      * Get isActive
  291.      *
  292.      * @return boolean 
  293.      */
  294.     public function getIsActive()
  295.     {
  296.         return $this->isActive;
  297.     }
  298.    
  299.     /**
  300.      * Set asset
  301.      *
  302.      * @param \Notaris\AdminBundle\Entity\Asset $asset
  303.      * @return SubsiteModule
  304.      */
  305.     public function setAsset(\Notaris\AdminBundle\Entity\Asset $asset = null)
  306.     {
  307.         $this->asset = $asset;
  308.         return $this;
  309.     }
  310.     /**
  311.      * Get asset
  312.      *
  313.      * @return \Notaris\AdminBundle\Entity\Asset 
  314.      */
  315.     public function getAsset()
  316.     {
  317.         return $this->asset;
  318.     }
  319.     /**
  320.      * Set position
  321.      *
  322.      * @param string $position
  323.      * @return SubsiteModule
  324.      */
  325.     public function setPosition($position)
  326.     {
  327.         $this->position = $position;
  328.         return $this;
  329.     }
  330.     /**
  331.      * Get position
  332.      *
  333.      * @return string 
  334.      */
  335.     public function getPosition()
  336.     {
  337.         return $this->position;
  338.     }
  339.     /**
  340.      * Set position_num
  341.      *
  342.      * @param integer $positionNum
  343.      * @return SubsiteModule
  344.      */
  345.     public function setPositionNum($positionNum)
  346.     {
  347.         $this->position_num = $positionNum;
  348.         return $this;
  349.     }
  350.     /**
  351.      * Get position_num
  352.      *
  353.      * @return integer 
  354.      */
  355.     public function getPositionNum()
  356.     {
  357.         return $this->position_num;
  358.     }
  359.     /**
  360.      * Set slug
  361.      *
  362.      * @param string $slug
  363.      * @return SubsiteModule
  364.      */
  365.     public function setSlug($slug)
  366.     {
  367.         $this->slug = $slug;
  368.         return $this;
  369.     }
  370.     /**
  371.      * Get slug
  372.      *
  373.      * @return string 
  374.      */
  375.     public function getSlug()
  376.     {
  377.         return $this->slug;
  378.     }
  379.     /**
  380.      * Set locale
  381.      *
  382.      * @param string $locale
  383.      * @return SubsiteModule
  384.      */
  385.     public function setLocale($locale)
  386.     {
  387.         $this->locale = $locale;
  388.         return $this;
  389.     }
  390.     /**
  391.      * Get locale
  392.      *
  393.      * @return string 
  394.      */
  395.     public function getLocale()
  396.     {
  397.         return $this->locale;
  398.     }
  399.        
  400.     /**
  401.      * Get position options
  402.      *
  403.      * @return array
  404.      */
  405.     public function getPositionOptions()
  406.     {
  407.         return array(
  408.             'CENTER'=>'CENTER',
  409.             'RIGHT'=>'RIGHT'
  410.         );
  411.     }
  412. }