Advertisement
Guest User

CategoryEntity

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