Category.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. namespace Tree\Fixture\Document;
  3. use Gedmo\Mapping\Annotation as Gedmo;
  4. use Doctrine\ODM\MongoDB\Mapping\Annotations as MONGO;
  5. /**
  6. * @MONGO\Document(repositoryClass="Gedmo\Tree\Document\MongoDB\Repository\MaterializedPathRepository")
  7. * @Gedmo\Tree(type="materializedPath")
  8. */
  9. class Category
  10. {
  11. /**
  12. * @MONGO\Id
  13. */
  14. private $id;
  15. /**
  16. * @MONGO\Field(type="string")
  17. * @Gedmo\TreePathSource
  18. */
  19. private $title;
  20. /**
  21. * @MONGO\Field(type="string")
  22. * @Gedmo\TreePath(separator="|")
  23. */
  24. private $path;
  25. /**
  26. * @Gedmo\TreeParent
  27. * @MONGO\ReferenceOne(targetDocument="Category")
  28. */
  29. private $parent;
  30. /**
  31. * @Gedmo\TreeLevel
  32. * @MONGO\Field(type="int")
  33. */
  34. private $level;
  35. public function getId()
  36. {
  37. return $this->id;
  38. }
  39. public function setTitle($title)
  40. {
  41. $this->title = $title;
  42. }
  43. public function getTitle()
  44. {
  45. return $this->title;
  46. }
  47. public function setParent(Category $parent = null)
  48. {
  49. $this->parent = $parent;
  50. }
  51. public function getParent()
  52. {
  53. return $this->parent;
  54. }
  55. public function getLevel()
  56. {
  57. return $this->level;
  58. }
  59. public function getPath()
  60. {
  61. return $this->path;
  62. }
  63. }