Page.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. namespace SoftDeleteable\Fixture\Entity;
  3. use Gedmo\Mapping\Annotation as Gedmo;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. /**
  7. * @ORM\Entity
  8. * @ORM\InheritanceType("JOINED")
  9. * @ORM\DiscriminatorColumn(name="discr", type="string")
  10. * @ORM\DiscriminatorMap({"page" = "Page", "mega_page" = "MegaPage"})
  11. * @Gedmo\SoftDeleteable(fieldName="deletedAt")
  12. */
  13. class Page
  14. {
  15. /**
  16. * @ORM\Column(name="id", type="integer")
  17. * @ORM\Id
  18. * @ORM\GeneratedValue(strategy="IDENTITY")
  19. */
  20. private $id;
  21. /**
  22. * @ORM\Column(name="title", type="string")
  23. */
  24. private $title;
  25. /**
  26. * @ORM\Column(name="deletedAt", type="datetime", nullable=true)
  27. */
  28. private $deletedAt;
  29. /**
  30. * @ORM\OneToMany(targetEntity="Module", mappedBy="page", cascade={"persist", "remove"})
  31. */
  32. private $modules;
  33. public function __construct()
  34. {
  35. $this->modules = new ArrayCollection();
  36. }
  37. public function getId()
  38. {
  39. return $this->id;
  40. }
  41. public function setTitle($title)
  42. {
  43. $this->title = $title;
  44. }
  45. public function getTitle()
  46. {
  47. return $this->title;
  48. }
  49. public function setDeletedAt($deletedAt)
  50. {
  51. $this->deletedAt = $deletedAt;
  52. }
  53. public function getDeletedAt()
  54. {
  55. return $this->deletedAt;
  56. }
  57. public function addModule(Module $module)
  58. {
  59. $this->module[] = $module;
  60. }
  61. }