Category.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. namespace Translatable\Fixture\Issue173;
  3. use Gedmo\Mapping\Annotation as Gedmo;
  4. use Doctrine\ORM\Mapping as ORM;
  5. /**
  6. * @ORM\Entity
  7. */
  8. class Category
  9. {
  10. /**
  11. * @ORM\Id
  12. * @ORM\GeneratedValue
  13. * @ORM\Column(type="integer")
  14. */
  15. private $id;
  16. /**
  17. * @Gedmo\Translatable
  18. * @ORM\Column(name="title", type="string", length=128)
  19. */
  20. private $title;
  21. /**
  22. * @ORM\OneToMany(targetEntity="Article", mappedBy="category", cascade={"persist", "remove"})
  23. */
  24. private $articles;
  25. /**
  26. * @ORM\OneToMany(targetEntity="Product", mappedBy="category", cascade={"persist", "remove"})
  27. */
  28. private $products;
  29. public function getId()
  30. {
  31. return $this->id;
  32. }
  33. public function setTitle($title)
  34. {
  35. $this->title = $title;
  36. }
  37. public function getTitle()
  38. {
  39. return $this->title;
  40. }
  41. public function addArticles(Article $article)
  42. {
  43. $this->articles[] = $article;
  44. }
  45. public function getArticles()
  46. {
  47. return $this->articles;
  48. }
  49. public function addProducts(Product $product)
  50. {
  51. $this->products[] = $product;
  52. }
  53. public function getProducts()
  54. {
  55. return $this->products;
  56. }
  57. }