src/Uniski/CMSBundle/Entity/Page.php line 12

Open in your IDE?
  1. <?php
  2. namespace Uniski\CMSBundle\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Gedmo\Mapping\Annotation as Gedmo;
  5. /**
  6. * @ORM\Entity
  7. * @ORM\Table("page")
  8. */
  9. class Page
  10. {
  11.   /**
  12.    * @var integer
  13.    *
  14.    * @ORM\Id
  15.    * @ORM\Column(name="id", type="integer")
  16.    * @ORM\GeneratedValue(strategy="IDENTITY")
  17.    */
  18.   protected $id;
  19.   /**
  20.    * @var   Uniski\ResourceBundle\Entity\Image
  21.    * @ORM\ManyToOne(targetEntity="Uniski\ResourceBundle\Entity\Image", cascade={"persist"})
  22.    * @ORM\JoinColumn(name="image_id", referencedColumnName="id", nullable=true)
  23.    */
  24.   protected $image;
  25.   /**
  26.    * @var   string
  27.    * @ORM\Column(name="title", type="string")
  28.    */
  29.   protected $title;
  30.   /**
  31.    * @var   string
  32.    * @ORM\Column(name="body", type="text")
  33.    */
  34.   protected $body;
  35.   /**
  36.    * @var   \DateTime
  37.    * @ORM\Column(name="created", type="datetime")
  38.    */
  39.   protected $created;
  40.   /**
  41.    * @Gedmo\Slug(fields={"title"})
  42.    * @ORM\Column(length=128, unique=true)
  43.    */
  44.   private $slug;
  45.   /**
  46.    * @ORM\Column(length=128, nullable=true)
  47.    */
  48.   private $prefix;
  49.   /**
  50.    * @var  array
  51.    * @ORM\Column(type="json")
  52.    */
  53.   protected $seo;
  54.   /**
  55.    * @var  array
  56.    * @ORM\Column(type="json")
  57.    */
  58.   protected $config;
  59.   /**
  60.    * @var  ArrayCollection
  61.    * @ORM\OneToMany(targetEntity="Offer", mappedBy="page")
  62.    */
  63.   protected $offers;
  64.     /**
  65.      * Get id
  66.      *
  67.      * @return integer
  68.      */
  69.     public function getId()
  70.     {
  71.         return $this->id;
  72.     }
  73.     /**
  74.      * Set title
  75.      *
  76.      * @param string $title
  77.      *
  78.      * @return Post
  79.      */
  80.     public function setTitle($title)
  81.     {
  82.         $this->title $title;
  83.         return $this;
  84.     }
  85.     /**
  86.      * Get title
  87.      *
  88.      * @return string
  89.      */
  90.     public function getTitle()
  91.     {
  92.         return $this->title;
  93.     }
  94.     /**
  95.      * Set body
  96.      *
  97.      * @param string $body
  98.      *
  99.      * @return Post
  100.      */
  101.     public function setBody($body)
  102.     {
  103.         $this->body $body;
  104.         return $this;
  105.     }
  106.     /**
  107.      * Get body
  108.      *
  109.      * @return string
  110.      */
  111.     public function getBody()
  112.     {
  113.         return $this->body;
  114.     }
  115.     /**
  116.      * Set created
  117.      *
  118.      * @param \DateTime $created
  119.      *
  120.      * @return Post
  121.      */
  122.     public function setCreated($created)
  123.     {
  124.         $this->created $created;
  125.         return $this;
  126.     }
  127.     /**
  128.      * Get created
  129.      *
  130.      * @return \DateTime
  131.      */
  132.     public function getCreated()
  133.     {
  134.         return $this->created;
  135.     }
  136.     /**
  137.      * Set slug
  138.      *
  139.      * @param string $slug
  140.      *
  141.      * @return Post
  142.      */
  143.     public function setSlug($slug)
  144.     {
  145.         $this->slug $slug;
  146.         return $this;
  147.     }
  148.     /**
  149.      * Get slug
  150.      *
  151.      * @return string
  152.      */
  153.     public function getSlug()
  154.     {
  155.         return $this->slug;
  156.     }
  157.     /**
  158.      * Set seo
  159.      *
  160.      * @param array $seo
  161.      *
  162.      * @return Post
  163.      */
  164.     public function setSeo($seo)
  165.     {
  166.         $this->seo $seo;
  167.         return $this;
  168.     }
  169.     /**
  170.      * Get seo
  171.      *
  172.      * @return array
  173.      */
  174.     public function getSeo()
  175.     {
  176.         return $this->seo;
  177.     }
  178.     /**
  179.      * Set image
  180.      *
  181.      * @param \Uniski\ResourceBundle\Entity\Image $image
  182.      *
  183.      * @return Post
  184.      */
  185.     public function setImage(\Uniski\ResourceBundle\Entity\Image $image null)
  186.     {
  187.         $this->image $image;
  188.         return $this;
  189.     }
  190.     /**
  191.      * Get image
  192.      *
  193.      * @return \Uniski\ResourceBundle\Entity\Image
  194.      */
  195.     public function getImage()
  196.     {
  197.         return $this->image;
  198.     }
  199.        /**
  200.      * Constructor
  201.      */
  202.     public function __construct()
  203.     {
  204.         $this->tags = new \Doctrine\Common\Collections\ArrayCollection();
  205.         $this->created = new \DateTime();
  206.     }
  207.     /**
  208.      * Add offer
  209.      *
  210.      * @param \Uniski\CMSBundle\Entity\Offer $offer
  211.      *
  212.      * @return Page
  213.      */
  214.     public function addOffer(\Uniski\CMSBundle\Entity\Offer $offer)
  215.     {
  216.         $this->offers[] = $offer;
  217.         return $this;
  218.     }
  219.     /**
  220.      * Remove offer
  221.      *
  222.      * @param \Uniski\CMSBundle\Entity\Offer $offer
  223.      */
  224.     public function removeOffer(\Uniski\CMSBundle\Entity\Offer $offer)
  225.     {
  226.         $this->offers->removeElement($offer);
  227.     }
  228.     /**
  229.      * Get offers
  230.      *
  231.      * @return \Doctrine\Common\Collections\Collection
  232.      */
  233.     public function getOffers()
  234.     {
  235.         return $this->offers;
  236.     }
  237.     /**
  238.      * Gets the value of config.
  239.      *
  240.      * @return  array
  241.      */
  242.     public function getConfig()
  243.     {
  244.         return $this->config;
  245.     }
  246.     /**
  247.      * Sets the value of config.
  248.      *
  249.      * @param  array $config the config
  250.      *
  251.      * @return self
  252.      */
  253.     public function setConfig($config)
  254.     {
  255.         $this->config $config;
  256.         return $this;
  257.     }
  258.     public function getWebForm()
  259.     {
  260.       if ($this->config && isset($this->config['webform'])) return $this->config['webform'];
  261.       return null;
  262.     }
  263.     /**
  264.      * @return mixed
  265.      */
  266.     public function getPrefix()
  267.     {
  268.         return $this->prefix;
  269.     }
  270.     /**
  271.      * @param mixed $prefix
  272.      *
  273.      * @return self
  274.      */
  275.     public function setPrefix($prefix)
  276.     {
  277.         $this->prefix $prefix;
  278.         return $this;
  279.     }
  280. }