Article.php 1.7 KB

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