Article.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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. /**
  42. * @var \DateTime
  43. * @ODM\Date
  44. * @Gedmo\Timestampable(on="change", field="isReady", value=true)
  45. */
  46. private $ready;
  47. /**
  48. * @var bool
  49. * @ODM\Boolean
  50. */
  51. private $isReady = false;
  52. public function getId()
  53. {
  54. return $this->id;
  55. }
  56. public function setTitle($title)
  57. {
  58. $this->title = $title;
  59. }
  60. public function getTitle()
  61. {
  62. return $this->title;
  63. }
  64. public function getCreated()
  65. {
  66. return $this->created;
  67. }
  68. public function getPublished()
  69. {
  70. return $this->published;
  71. }
  72. public function getUpdated()
  73. {
  74. return $this->updated;
  75. }
  76. public function setType(Type $type)
  77. {
  78. $this->type = $type;
  79. }
  80. public function getType()
  81. {
  82. return $this->type;
  83. }
  84. public function setCreated($created)
  85. {
  86. $this->created = $created;
  87. }
  88. public function setPublished(\DateTime $published)
  89. {
  90. $this->published = $published;
  91. }
  92. public function setUpdated(\DateTime $updated)
  93. {
  94. $this->updated = $updated;
  95. }
  96. public function setReady($ready)
  97. {
  98. $this->ready = $ready;
  99. return $this;
  100. }
  101. public function getReady()
  102. {
  103. return $this->ready;
  104. }
  105. public function setIsReady($isReady)
  106. {
  107. $this->isReady = $isReady;
  108. return $this;
  109. }
  110. public function getIsReady()
  111. {
  112. return $this->isReady;
  113. }
  114. }