Category.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <?php
  2. namespace Mapping\Fixture\Yaml;
  3. /**
  4. *
  5. * @Table(name="categories")
  6. * @Entity
  7. */
  8. class Category extends BaseCategory
  9. {
  10. /**
  11. * @var integer $id
  12. *
  13. * @Column(name="id", type="integer")
  14. * @Id
  15. * @GeneratedValue(strategy="IDENTITY")
  16. */
  17. private $id;
  18. /**
  19. * @var string $title
  20. *
  21. * @Column(name="title", type="string", length=64)
  22. */
  23. private $title;
  24. /**
  25. * @var string $slug
  26. *
  27. * @Column(name="slug", type="string", length=64)
  28. */
  29. private $slug;
  30. /**
  31. * @var Entity\Category
  32. *
  33. * @OneToMany(targetEntity="Category", mappedBy="parent")
  34. */
  35. private $children;
  36. /**
  37. * @var Entity\Category
  38. *
  39. * @ManyToOne(targetEntity="Category", inversedBy="children")
  40. * @JoinColumns({
  41. * @JoinColumn(name="parent_id", referencedColumnName="id")
  42. * })
  43. */
  44. private $parent;
  45. private $changed;
  46. /**
  47. * Get id
  48. *
  49. * @return integer $id
  50. */
  51. public function getId()
  52. {
  53. return $this->id;
  54. }
  55. /**
  56. * Set title
  57. *
  58. * @param string $title
  59. */
  60. public function setTitle($title)
  61. {
  62. $this->title = $title;
  63. }
  64. /**
  65. * Get title
  66. *
  67. * @return string $title
  68. */
  69. public function getTitle()
  70. {
  71. return $this->title;
  72. }
  73. /**
  74. * Set slug
  75. *
  76. * @param string $slug
  77. */
  78. public function setSlug($slug)
  79. {
  80. $this->slug = $slug;
  81. }
  82. /**
  83. * Get slug
  84. *
  85. * @return string $slug
  86. */
  87. public function getSlug()
  88. {
  89. return $this->slug;
  90. }
  91. /**
  92. * Add children
  93. *
  94. * @param Entity\Category $children
  95. */
  96. public function addChildren(Category $children)
  97. {
  98. $this->children[] = $children;
  99. }
  100. /**
  101. * Get children
  102. *
  103. * @return Doctrine\Common\Collections\Collection $children
  104. */
  105. public function getChildren()
  106. {
  107. return $this->children;
  108. }
  109. /**
  110. * Set parent
  111. *
  112. * @param Entity\Category $parent
  113. */
  114. public function setParent($parent)
  115. {
  116. $this->parent = $parent;
  117. }
  118. /**
  119. * Get parent
  120. *
  121. * @return Entity\Category $parent
  122. */
  123. public function getParent()
  124. {
  125. return $this->parent;
  126. }
  127. }