UserTimeAware.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. namespace SoftDeleteable\Fixture\Document;
  3. use Gedmo\Mapping\Annotation as Gedmo;
  4. use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
  5. /**
  6. * @ODM\Document(collection="users")
  7. * @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=true)
  8. */
  9. class UserTimeAware
  10. {
  11. /** @ODM\Id */
  12. private $id;
  13. /** @ODM\String */
  14. private $username;
  15. /** @ODM\Date */
  16. protected $deletedAt;
  17. /**
  18. * Sets deletedAt.
  19. *
  20. * @param Datetime $deletedAt
  21. * @return $this
  22. */
  23. public function setDeletedAt(\DateTime $deletedAt)
  24. {
  25. $this->deletedAt = $deletedAt;
  26. return $this;
  27. }
  28. /**
  29. * Returns deletedAt.
  30. *
  31. * @return DateTime
  32. */
  33. public function getDeletedAt()
  34. {
  35. return $this->deletedAt;
  36. }
  37. public function getId()
  38. {
  39. return $this->id;
  40. }
  41. public function setUsername($username)
  42. {
  43. $this->username = $username;
  44. }
  45. public function getUsername()
  46. {
  47. return $this->username;
  48. }
  49. }