Guest User

Untitled

a guest
Nov 17th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.86 KB | None | 0 0
  1. <?php
  2.  
  3. namespace Schuh\BlogBundle\Document;
  4.  
  5. use Doctrine\ODM\MongoDB\Mapping\Annotations as MongoDB;
  6. use Gedmo\Mapping\Annotation as Gedmo;
  7.  
  8. /**
  9.  * @MongoDB\Document
  10.  */
  11. class Article
  12. {
  13.     /**
  14.      * @MongoDB\Id
  15.      */
  16.     protected $id;
  17.    
  18.     /**
  19.      * @MongoDB\ReferenceOne(targetDocument="User", mappedBy="id")
  20.      */
  21.     protected $author;
  22.    
  23.     /**
  24.      * @MongoDB\String
  25.      */
  26.     protected $title;
  27.    
  28.     /**
  29.      * @MongoDB\String
  30.      * @GedmoSluggable(fields={"title"}, updatable=false, separator="-")
  31.      */
  32.     protected $slug;
  33.    
  34.     /**
  35.      * @MongoDB\String
  36.      */
  37.     protected $text;
  38.    
  39.     /**
  40.      * @MongoDB\EmbedMany(targetDocument="Comment")
  41.      */
  42.     protected $comments;
  43.    
  44.     /**
  45.      * @GedmoTimestampable(on="create")
  46.      * @MongoDB\Date
  47.      */
  48.     protected $created;
  49.    
  50.     /**
  51.      * @GedmoTimestampable(on="update")
  52.      * @MongoDB\Date
  53.      */
  54.     protected $updated;
  55.    
  56.     /**
  57.      * @MongoDB\Date
  58.      */
  59.     protected $published;
  60.  
  61.  
  62.     public function __construct()
  63.     {
  64.         $this->comments = new \Doctrine\Common\Collections\ArrayCollection();
  65.     }
  66.    
  67.     /**
  68.      * Get id
  69.      *
  70.      * @return id $id
  71.      */
  72.     public function getId()
  73.     {
  74.         return $this->id;
  75.     }
  76.  
  77.     /**
  78.      * Set title
  79.      *
  80.      * @param string $title
  81.      * @return Article
  82.      */
  83.     public function setTitle($title)
  84.     {
  85.         $this->title = $title;
  86.         return $this;
  87.     }
  88.  
  89.     /**
  90.      * Get title
  91.      *
  92.      * @return string $title
  93.      */
  94.     public function getTitle()
  95.     {
  96.         return $this->title;
  97.     }
  98.  
  99.     /**
  100.      * Set text
  101.      *
  102.      * @param string $text
  103.      * @return Article
  104.      */
  105.     public function setText($text)
  106.     {
  107.         $this->text = $text;
  108.         return $this;
  109.     }
  110.  
  111.     /**
  112.      * Get text
  113.      *
  114.      * @return string $text
  115.      */
  116.     public function getText()
  117.     {
  118.         return $this->text;
  119.     }
  120.  
  121.     /**
  122.      * Add comments
  123.      *
  124.      * @param Schuh\BlogBundle\Document\Comment $comments
  125.      */
  126.     public function addComments(\Schuh\BlogBundle\Document\Comment $comments)
  127.     {
  128.         $this->comments[] = $comments;
  129.     }
  130.  
  131.     /**
  132.      * Get comments
  133.      *
  134.      * @return Doctrine\Common\Collections\Collection $comments
  135.      */
  136.     public function getComments()
  137.     {
  138.         return $this->comments;
  139.     }
  140.  
  141.     /**
  142.      * Set author
  143.      *
  144.      * @param Schuh\BlogBundle\Document\User $author
  145.      * @return Article
  146.      */
  147.     public function setAuthor(\Schuh\BlogBundle\Document\User $author)
  148.     {
  149.         $this->author = $author;
  150.         return $this;
  151.     }
  152.  
  153.     /**
  154.      * Get author
  155.      *
  156.      * @return Schuh\BlogBundle\Document\User $author
  157.      */
  158.     public function getAuthor()
  159.     {
  160.         return $this->author;
  161.     }
  162. }
Add Comment
Please, Sign In to add comment