BaseNode.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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="Gedmo\Tree\Entity\Repository\NestedTreeRepository")
  7. * @ORM\InheritanceType("SINGLE_TABLE")
  8. * @ORM\DiscriminatorColumn(name="discriminator", type="string")
  9. * @ORM\DiscriminatorMap({"base" = "BaseNode", "node" = "Node"})
  10. * @Gedmo\Tree(type="nested")
  11. */
  12. class BaseNode extends ANode
  13. {
  14. /**
  15. * @ORM\OneToMany(targetEntity="BaseNode", mappedBy="parent")
  16. */
  17. private $children;
  18. /**
  19. * @Gedmo\Timestampable(on="create")
  20. * @ORM\Column(type="datetime")
  21. */
  22. private $created;
  23. /**
  24. * @ORM\Column(length=128, unique=true)
  25. */
  26. private $identifier;
  27. /**
  28. * @ORM\Column(type="datetime")
  29. * @Gedmo\Timestampable
  30. */
  31. private $updated;
  32. public function getCreated()
  33. {
  34. return $this->created;
  35. }
  36. public function getUpdated()
  37. {
  38. return $this->updated;
  39. }
  40. public function getChildren()
  41. {
  42. return $this->children;
  43. }
  44. public function getIdentifier()
  45. {
  46. return $this->identifier;
  47. }
  48. public function setIdentifier($identifier)
  49. {
  50. $this->identifier = $identifier;
  51. }
  52. }