BaseNode.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. namespace Tree\Fixture;
  3. /**
  4. * @Entity(repositoryClass="Gedmo\Tree\Repository\TreeNodeRepository")
  5. * @InheritanceType("SINGLE_TABLE")
  6. * @DiscriminatorColumn(name="discriminator", type="string")
  7. * @DiscriminatorMap({"base" = "BaseNode", "node" = "Node"})
  8. */
  9. class BaseNode extends ANode
  10. {
  11. /**
  12. * @gedmo:TreeParent
  13. * @ManyToOne(targetEntity="BaseNode", inversedBy="children")
  14. */
  15. private $parent;
  16. /**
  17. * @OneToMany(targetEntity="BaseNode", mappedBy="parent")
  18. */
  19. private $children;
  20. /**
  21. * @gedmo:Timestampable(on="create")
  22. * @Column(type="datetime")
  23. */
  24. private $created;
  25. /**
  26. * @Column(length=128, unique=true)
  27. */
  28. private $identifier;
  29. /**
  30. * @Column(type="datetime")
  31. * @gedmo:Timestampable
  32. */
  33. private $updated;
  34. public function getCreated()
  35. {
  36. return $this->created;
  37. }
  38. public function getUpdated()
  39. {
  40. return $this->updated;
  41. }
  42. public function setParent($parent = null)
  43. {
  44. $this->parent = $parent;
  45. }
  46. public function getChildren()
  47. {
  48. return $this->children;
  49. }
  50. public function getParent()
  51. {
  52. return $this->parent;
  53. }
  54. public function getIdentifier()
  55. {
  56. return $this->identifier;
  57. }
  58. public function setIdentifier($identifier)
  59. {
  60. $this->identifier = $identifier;
  61. }
  62. }