Article.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <?php
  2. namespace Timestampable\Fixture\Document;
  3. /**
  4. * @Document(collection="articles")
  5. */
  6. class Article
  7. {
  8. /** @Id */
  9. private $id;
  10. /**
  11. * @String
  12. */
  13. private $title;
  14. /**
  15. * @ReferenceOne(targetDocument="Type")
  16. */
  17. private $type;
  18. /**
  19. * @var timestamp $created
  20. *
  21. * @Timestamp
  22. * @gedmo:Timestampable(on="create")
  23. */
  24. private $created;
  25. /**
  26. * @var date $updated
  27. *
  28. * @Date
  29. * @gedmo:Timestampable
  30. */
  31. private $updated;
  32. /**
  33. * @var date $published
  34. *
  35. * @Date
  36. * @gedmo:Timestampable(on="change", field="type.title", value="Published")
  37. */
  38. private $published;
  39. public function getId()
  40. {
  41. return $this->id;
  42. }
  43. public function setTitle($title)
  44. {
  45. $this->title = $title;
  46. }
  47. public function getTitle()
  48. {
  49. return $this->title;
  50. }
  51. public function getCreated()
  52. {
  53. return $this->created;
  54. }
  55. public function getPublished()
  56. {
  57. return $this->published;
  58. }
  59. public function getUpdated()
  60. {
  61. return $this->updated;
  62. }
  63. public function setType(Type $type)
  64. {
  65. $this->type = $type;
  66. }
  67. public function getType()
  68. {
  69. return $this->type;
  70. }
  71. public function setCreated($created)
  72. {
  73. $this->created = $created;
  74. }
  75. public function setPublished(\DateTime $published)
  76. {
  77. $this->published = $published;
  78. }
  79. public function setUpdated(\DateTime $updated)
  80. {
  81. $this->updated = $updated;
  82. }
  83. }