Occupation.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <?php
  2. namespace Sluggable\Fixture\Handler\People;
  3. use Gedmo\Mapping\Annotation as Gedmo;
  4. use Doctrine\ORM\Mapping as ORM;
  5. /**
  6. * @Gedmo\Tree(type="nested")
  7. * @ORM\Entity(repositoryClass="Gedmo\Tree\Entity\Repository\NestedTreeRepository")
  8. */
  9. class Occupation
  10. {
  11. /**
  12. * @ORM\Id
  13. * @ORM\GeneratedValue
  14. * @ORM\Column(type="integer")
  15. */
  16. private $id;
  17. /**
  18. * @ORM\Column(length=64)
  19. */
  20. private $title;
  21. /**
  22. * @Gedmo\Slug(handlers={
  23. * @Gedmo\SlugHandler(class="Gedmo\Sluggable\Handler\TreeSlugHandler", options={
  24. * @Gedmo\SlugHandlerOption(name="parentRelationField", value="parent"),
  25. * @Gedmo\SlugHandlerOption(name="separator", value="/")
  26. * }),
  27. * @Gedmo\SlugHandler(class="Gedmo\Sluggable\Handler\InversedRelativeSlugHandler", options={
  28. * @Gedmo\SlugHandlerOption(name="relationClass", value="Sluggable\Fixture\Handler\People\Person"),
  29. * @Gedmo\SlugHandlerOption(name="mappedBy", value="occupation"),
  30. * @Gedmo\SlugHandlerOption(name="inverseSlugField", value="slug")
  31. * })
  32. * }, fields={"title"})
  33. * @ORM\Column(length=64, unique=true)
  34. */
  35. private $slug;
  36. /**
  37. * @Gedmo\TreeParent
  38. * @ORM\ManyToOne(targetEntity="Occupation")
  39. * @ORM\JoinColumn(name="parent_id", referencedColumnName="id", onDelete="SET NULL")
  40. */
  41. private $parent;
  42. /**
  43. * @Gedmo\TreeLeft
  44. * @ORM\Column(type="integer")
  45. */
  46. private $lft;
  47. /**
  48. * @Gedmo\TreeRight
  49. * @ORM\Column(type="integer")
  50. */
  51. private $rgt;
  52. /**
  53. * @Gedmo\TreeRoot
  54. * @ORM\Column(type="integer")
  55. */
  56. private $root;
  57. /**
  58. * @Gedmo\TreeLevel
  59. * @ORM\Column(name="lvl", type="integer")
  60. */
  61. private $level;
  62. public function setParent(TreeSlug $parent = null)
  63. {
  64. $this->parent = $parent;
  65. }
  66. public function getChildren()
  67. {
  68. return $this->children;
  69. }
  70. public function getParent()
  71. {
  72. return $this->parent;
  73. }
  74. public function getRoot()
  75. {
  76. return $this->root;
  77. }
  78. public function getLeft()
  79. {
  80. return $this->lft;
  81. }
  82. public function getRight()
  83. {
  84. return $this->rgt;
  85. }
  86. public function getLevel()
  87. {
  88. return $this->level;
  89. }
  90. public function getId()
  91. {
  92. return $this->id;
  93. }
  94. public function setTitle($title)
  95. {
  96. $this->title = $title;
  97. }
  98. public function getTitle()
  99. {
  100. return $this->title;
  101. }
  102. public function getSlug()
  103. {
  104. return $this->slug;
  105. }
  106. }