src/Uniski/CMSBundle/Entity/Post.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(repositoryClass="Uniski\CMSBundle\Repository\PostRepository")
  7. * @ORM\Table("post")
  8. */
  9. class Post
  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.    * @Gedmo\Slug(fields={"title"})
  37.    * @ORM\Column(length=128, unique=true)
  38.    */
  39.   private $slug;
  40.   /**
  41.    * @var  array
  42.    * @ORM\Column(name="seo", type="json")
  43.    */
  44.   protected $seo;
  45.   /**
  46.    * @var  boolean
  47.    * @ORM\Column(name="stick", type="boolean")
  48.    */
  49.   protected $stick;
  50.   /**
  51.    * @var   \Doctrine\Common\Collections\ArrayCollection
  52.    * @ORM\ManyToMany(targetEntity="\Uniski\ConfigBundle\Entity\Category", cascade={"persist","merge"})
  53.    * @ORM\JoinTable(name="post_tags",
  54.    *   joinColumns={@ORM\JoinColumn(name="post_id", referencedColumnName="id")},
  55.    *   inverseJoinColumns={@ORM\JoinColumn(name="tag_id", referencedColumnName="id")})
  56.    */
  57.   protected $tags;
  58.   /**
  59.    * @var \DateTime $created
  60.    *
  61.    * @Gedmo\Timestampable(on="create")
  62.    * @ORM\Column(type="datetime")
  63.    */
  64.   protected $created;
  65.   /**
  66.    * @var \DateTime $updated
  67.    *
  68.    * @Gedmo\Timestampable
  69.    * @ORM\Column(type="datetime")
  70.    */
  71.   protected $updated;
  72.     /**
  73.      * Get id
  74.      *
  75.      * @return integer
  76.      */
  77.     public function getId()
  78.     {
  79.         return $this->id;
  80.     }
  81.     /**
  82.      * Set title
  83.      *
  84.      * @param string $title
  85.      *
  86.      * @return Post
  87.      */
  88.     public function setTitle($title)
  89.     {
  90.         $this->title $title;
  91.         return $this;
  92.     }
  93.     /**
  94.      * Get title
  95.      *
  96.      * @return string
  97.      */
  98.     public function getTitle()
  99.     {
  100.         return $this->title;
  101.     }
  102.     /**
  103.      * Set body
  104.      *
  105.      * @param string $body
  106.      *
  107.      * @return Post
  108.      */
  109.     public function setBody($body)
  110.     {
  111.         $this->body $body;
  112.         return $this;
  113.     }
  114.     /**
  115.      * Get body
  116.      *
  117.      * @return string
  118.      */
  119.     public function getBody()
  120.     {
  121.         return $this->body;
  122.     }
  123.     /**
  124.      * Set slug
  125.      *
  126.      * @param string $slug
  127.      *
  128.      * @return Post
  129.      */
  130.     public function setSlug($slug)
  131.     {
  132.         $this->slug $slug;
  133.         return $this;
  134.     }
  135.     /**
  136.      * Get slug
  137.      *
  138.      * @return string
  139.      */
  140.     public function getSlug()
  141.     {
  142.         return $this->slug;
  143.     }
  144.     /**
  145.      * Set seo
  146.      *
  147.      * @param array $seo
  148.      *
  149.      * @return Post
  150.      */
  151.     public function setSeo($seo)
  152.     {
  153.         $this->seo $seo;
  154.         return $this;
  155.     }
  156.     /**
  157.      * Get seo
  158.      *
  159.      * @return array
  160.      */
  161.     public function getSeo()
  162.     {
  163.         return $this->seo;
  164.     }
  165.     /**
  166.      * Set image
  167.      *
  168.      * @param \Uniski\ResourceBundle\Entity\Image $image
  169.      *
  170.      * @return Post
  171.      */
  172.     public function setImage(\Uniski\ResourceBundle\Entity\Image $image)
  173.     {
  174.         $this->image $image;
  175.         return $this;
  176.     }
  177.     /**
  178.      * Get image
  179.      *
  180.      * @return \Uniski\ResourceBundle\Entity\Image
  181.      */
  182.     public function getImage()
  183.     {
  184.         return $this->image;
  185.     }
  186.     /**
  187.      * Set stick
  188.      *
  189.      * @param boolean $stick
  190.      *
  191.      * @return Post
  192.      */
  193.     public function setStick($stick)
  194.     {
  195.         $this->stick $stick;
  196.         return $this;
  197.     }
  198.     /**
  199.      * Get stick
  200.      *
  201.      * @return boolean
  202.      */
  203.     public function getStick()
  204.     {
  205.         return $this->stick;
  206.     }
  207.     /**
  208.      * Constructor
  209.      */
  210.     public function __construct()
  211.     {
  212.         $this->tags = new \Doctrine\Common\Collections\ArrayCollection();
  213.         $this->created = new \DateTime();
  214.         $this->stick false;
  215.     }
  216.     /**
  217.      * Add tag
  218.      *
  219.      * @param \Uniski\ConfigBundle\Entity\Category $tag
  220.      *
  221.      * @return Post
  222.      */
  223.     public function addTag(\Uniski\ConfigBundle\Entity\Category $tag)
  224.     {
  225.         $this->tags[] = $tag;
  226.         return $this;
  227.     }
  228.     /**
  229.      * Remove tag
  230.      *
  231.      * @param \Uniski\ConfigBundle\Entity\Category $tag
  232.      */
  233.     public function removeTag(\Uniski\ConfigBundle\Entity\Category $tag)
  234.     {
  235.         $this->tags->removeElement($tag);
  236.     }
  237.     /**
  238.      * Get tags
  239.      *
  240.      * @return \Doctrine\Common\Collections\Collection
  241.      */
  242.     public function getTags()
  243.     {
  244.         return $this->tags;
  245.     }
  246.     /**
  247.      * Gets the value of updated.
  248.      *
  249.      * @return \DateTime $updated
  250.      */
  251.     public function getUpdated()
  252.     {
  253.         return $this->updated;
  254.     }
  255.     /**
  256.      * Sets the value of updated.
  257.      *
  258.      * @param \DateTime $updated $updated the updated
  259.      *
  260.      * @return self
  261.      */
  262.     public function setUpdated($updated)
  263.     {
  264.         $this->updated $updated;
  265.         return $this;
  266.     }
  267.     /**
  268.      * Gets the value of created.
  269.      *
  270.      * @return \DateTime $created
  271.      */
  272.     public function getCreated()
  273.     {
  274.         return $this->created;
  275.     }
  276.     /**
  277.      * Sets the value of created.
  278.      *
  279.      * @param \DateTime $created $created the created
  280.      *
  281.      * @return self
  282.      */
  283.     public function setCreated($created)
  284.     {
  285.         $this->created $created;
  286.         return $this;
  287.     }
  288. }