BehavioralCategory.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?php
  2. namespace Tree\Fixture;
  3. use Gedmo\Mapping\Annotation as Gedmo;
  4. use Doctrine\ORM\Mapping as ORM;
  5. /**
  6. * @ORM\Entity(repositoryClass="Tree\Fixture\Repository\BehavioralCategoryRepository")
  7. * @Gedmo\Tree(type="nested")
  8. */
  9. class BehavioralCategory
  10. {
  11. /**
  12. * @ORM\Column(name="id", type="integer")
  13. * @ORM\Id
  14. * @ORM\GeneratedValue
  15. */
  16. private $id;
  17. /**
  18. * @Gedmo\Translatable
  19. * @ORM\Column(name="title", type="string", length=64)
  20. */
  21. private $title;
  22. /**
  23. * @Gedmo\TreeLeft
  24. * @ORM\Column(name="lft", type="integer", nullable=true)
  25. */
  26. private $lft;
  27. /**
  28. * @Gedmo\TreeRight
  29. * @ORM\Column(name="rgt", type="integer", nullable=true)
  30. */
  31. private $rgt;
  32. /**
  33. * @Gedmo\TreeParent
  34. * @ORM\ManyToOne(targetEntity="BehavioralCategory", inversedBy="children")
  35. * @ORM\JoinColumns({
  36. * @ORM\JoinColumn(name="parent_id", referencedColumnName="id", onDelete="SET NULL")
  37. * })
  38. */
  39. private $parent;
  40. /**
  41. * @ORM\OneToMany(targetEntity="BehavioralCategory", mappedBy="parent")
  42. */
  43. private $children;
  44. /**
  45. * @Gedmo\Translatable
  46. * @Gedmo\Slug(fields={"title"})
  47. * @ORM\Column(name="slug", type="string", length=128, unique=true)
  48. */
  49. private $slug;
  50. public function getId()
  51. {
  52. return $this->id;
  53. }
  54. public function getSlug()
  55. {
  56. return $this->slug;
  57. }
  58. public function setTitle($title)
  59. {
  60. $this->title = $title;
  61. }
  62. public function getTitle()
  63. {
  64. return $this->title;
  65. }
  66. public function setParent(BehavioralCategory $parent)
  67. {
  68. $this->parent = $parent;
  69. }
  70. public function getParent()
  71. {
  72. return $this->parent;
  73. }
  74. }