Article.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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", activateLocking=true)
  8. */
  9. class Article
  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="Article")
  28. */
  29. private $parent;
  30. /**
  31. * @Gedmo\TreeLevel
  32. * @MONGO\Field(type="int")
  33. */
  34. private $level;
  35. /**
  36. * @Gedmo\TreeLockTime
  37. * @MONGO\Field(type="date")
  38. */
  39. private $lockTime;
  40. public function getId()
  41. {
  42. return $this->id;
  43. }
  44. public function setTitle($title)
  45. {
  46. $this->title = $title;
  47. }
  48. public function getTitle()
  49. {
  50. return $this->title;
  51. }
  52. public function setParent(Article $parent = null)
  53. {
  54. $this->parent = $parent;
  55. }
  56. public function getParent()
  57. {
  58. return $this->parent;
  59. }
  60. public function getLevel()
  61. {
  62. return $this->level;
  63. }
  64. public function getPath()
  65. {
  66. return $this->path;
  67. }
  68. public function getLockTime()
  69. {
  70. return $this->lockTime;
  71. }
  72. }