AbstractLogEntry.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <?php
  2. namespace Gedmo\Loggable\Document;
  3. use Doctrine\ODM\MongoDB\Mapping\Annotations\MappedSuperclass;
  4. use Doctrine\ODM\MongoDB\Mapping\Annotations\Id;
  5. use Doctrine\ODM\MongoDB\Mapping\Annotations\String;
  6. use Doctrine\ODM\MongoDB\Mapping\Annotations\Index;
  7. use Doctrine\ODM\MongoDB\Mapping\Annotations\Date;
  8. use Doctrine\ODM\MongoDB\Mapping\Annotations\Int;
  9. use Doctrine\ODM\MongoDB\Mapping\Annotations\Hash;
  10. /**
  11. * Gedmo\Loggable\Document\AbstractLogEntry
  12. *
  13. * @MappedSuperclass
  14. */
  15. abstract class AbstractLogEntry
  16. {
  17. /**
  18. * @var integer $id
  19. *
  20. * @Id
  21. */
  22. protected $id;
  23. /**
  24. * @var string $action
  25. *
  26. * @String
  27. */
  28. protected $action;
  29. /**
  30. * @var datetime $loggedAt
  31. *
  32. * @Index
  33. * @Date
  34. */
  35. protected $loggedAt;
  36. /**
  37. * @var string $objectId
  38. *
  39. * @String(nullable=true)
  40. */
  41. protected $objectId;
  42. /**
  43. * @var string $objectClass
  44. *
  45. * @Index
  46. * @String
  47. */
  48. protected $objectClass;
  49. /**
  50. * @var integer $version
  51. *
  52. * @Int
  53. */
  54. protected $version;
  55. /**
  56. * @var text $data
  57. *
  58. * @Hash(nullable=true)
  59. */
  60. protected $data;
  61. /**
  62. * @var string $data
  63. *
  64. * @Index
  65. * @String(nullable=true)
  66. */
  67. protected $username;
  68. /**
  69. * Get action
  70. *
  71. * @return string
  72. */
  73. public function getAction()
  74. {
  75. return $this->action;
  76. }
  77. /**
  78. * Set action
  79. *
  80. * @param string $action
  81. */
  82. public function setAction($action)
  83. {
  84. $this->action = $action;
  85. }
  86. /**
  87. * Get object class
  88. *
  89. * @return string
  90. */
  91. public function getObjectClass()
  92. {
  93. return $this->objectClass;
  94. }
  95. /**
  96. * Set object class
  97. *
  98. * @param string $objectClass
  99. */
  100. public function setObjectClass($objectClass)
  101. {
  102. $this->objectClass = $objectClass;
  103. }
  104. /**
  105. * Get object id
  106. *
  107. * @return string
  108. */
  109. public function getObjectId()
  110. {
  111. return $this->objectId;
  112. }
  113. /**
  114. * Set object id
  115. *
  116. * @param string $objectId
  117. */
  118. public function setObjectId($objectId)
  119. {
  120. $this->objectId = $objectId;
  121. }
  122. /**
  123. * Get username
  124. *
  125. * @return string
  126. */
  127. public function getUsername()
  128. {
  129. return $this->username;
  130. }
  131. /**
  132. * Set username
  133. *
  134. * @param string $username
  135. */
  136. public function setUsername($username)
  137. {
  138. $this->username = $username;
  139. }
  140. /**
  141. * Get loggedAt
  142. *
  143. * @return datetime
  144. */
  145. public function getLoggedAt()
  146. {
  147. return $this->loggedAt;
  148. }
  149. /**
  150. * Set loggedAt
  151. *
  152. * @param string $loggedAt
  153. */
  154. public function setLoggedAt()
  155. {
  156. $this->loggedAt = new \DateTime();
  157. }
  158. /**
  159. * Get data
  160. *
  161. * @return array or null
  162. */
  163. public function getData()
  164. {
  165. return $this->data;
  166. }
  167. /**
  168. * Set data
  169. *
  170. * @param array $data
  171. */
  172. public function setData($data)
  173. {
  174. $this->data = $data;
  175. }
  176. /**
  177. * Set current version
  178. *
  179. * @param integer $version
  180. */
  181. public function setVersion($version)
  182. {
  183. $this->version = $version;
  184. }
  185. /**
  186. * Get current version
  187. *
  188. * @return integer
  189. */
  190. public function getVersion()
  191. {
  192. return $this->version;
  193. }
  194. }