Advertisement
Guest User

Category

a guest
Nov 9th, 2016
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.72 KB | None | 0 0
  1. <?php
  2.  
  3. namespace SoftUniBlogBundle\Entity;
  4.  
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\ORM\Mapping as ORM;
  7.  
  8. /**
  9.  * Category
  10.  *
  11.  * @ORM\Table(name="categories")
  12.  * @ORM\Entity(repositoryClass="SoftUniBlogBundle\Repository\CategoryRepository")
  13.  */
  14. class Category
  15. {
  16.     /**
  17.      * @var int
  18.      *
  19.      * @ORM\Column(name="id", type="integer")
  20.      * @ORM\Id
  21.      * @ORM\GeneratedValue(strategy="AUTO")
  22.      */
  23.     private $id;
  24.  
  25.     /**
  26.      * @var string
  27.      *
  28.      * @ORM\Column(name="name", type="string", length=255)
  29.      */
  30.     private $name;
  31.  
  32.  
  33.     /**
  34.      * @var ArrayCollection
  35.      *
  36.      * @ORM\OneToMany(targetEntity="\SoftUniBlogBundle\Entity\Article", mappedBy="category")
  37.      */
  38.     private $articles;
  39.  
  40.  
  41.     /**
  42.      * Get id
  43.      *
  44.      * @return int
  45.      */
  46.     public function getId()
  47.     {
  48.         return $this->id;
  49.     }
  50.  
  51.     /**
  52.      * Set name
  53.      *
  54.      * @param string $name
  55.      *
  56.      * @return Category
  57.      */
  58.     public function setName($name)
  59.     {
  60.         $this->name = $name;
  61.  
  62.         return $this;
  63.     }
  64.  
  65.     /**
  66.      * Get name
  67.      *
  68.      * @return string
  69.      */
  70.     public function getName()
  71.     {
  72.         return $this->name;
  73.     }
  74.  
  75.     /**
  76.      * @return ArrayCollection
  77.      */
  78.     public function getArticles()
  79.     {
  80.         return $this->articles;
  81.     }
  82.  
  83.  
  84.     /**
  85.      * @param ArrayCollection $articles
  86.      */
  87.     public function setArticles(ArrayCollection $articles)
  88.     {
  89.         $this->articles = $articles;
  90.     }
  91.  
  92.     public function __construct()
  93.     {
  94.         $this->articles = new ArrayCollection();
  95.     }
  96.  
  97.     public function __toString()
  98.     {
  99.         return $this->getName();
  100.     }
  101. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement