Person.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. namespace Tree\Fixture\Closure;
  3. /**
  4. * @gedmo:Tree(type="closure")
  5. * @gedmo:TreeClosure(class="Tree\Fixture\Closure\PersonClosure")
  6. * @Entity(repositoryClass="Gedmo\Tree\Entity\Repository\ClosureTreeRepository")
  7. * @InheritanceType("JOINED")
  8. * @DiscriminatorColumn(name="discriminator", type="string")
  9. * @DiscriminatorMap({
  10. "user" = "User"
  11. })
  12. */
  13. class Person
  14. {
  15. /**
  16. * @Column(name="id", type="integer")
  17. * @Id
  18. * @GeneratedValue
  19. */
  20. private $id;
  21. /**
  22. * @Column(name="full_name", type="string", length=64)
  23. */
  24. private $fullName;
  25. /**
  26. * @gedmo:TreeParent
  27. * @JoinColumn(name="parent_id", referencedColumnName="id", onDelete="CASCADE")
  28. * @ManyToOne(targetEntity="Person", inversedBy="children", cascade={"persist"})
  29. */
  30. private $parent;
  31. public function getId()
  32. {
  33. return $this->id;
  34. }
  35. public function setName($name)
  36. {
  37. $this->name = $name;
  38. }
  39. public function getName()
  40. {
  41. return $this->name;
  42. }
  43. public function setParent(Category $parent = null)
  44. {
  45. $this->parent = $parent;
  46. }
  47. public function getParent()
  48. {
  49. return $this->parent;
  50. }
  51. public function addClosure(CategoryClosure $closure)
  52. {
  53. $this->closures[] = $closure;
  54. }
  55. }