vendor/gedmo/doctrine-extensions/src/Loggable/Entity/MappedSuperclass/AbstractLogEntry.php line 25

Open in your IDE?
  1. <?php
  2. /*
  3. * This file is part of the Doctrine Behavioral Extensions package.
  4. * (c) Gediminas Morkevicius <gediminas.morkevicius@gmail.com> http://www.gediminasm.org
  5. * For the full copyright and license information, please view the LICENSE
  6. * file that was distributed with this source code.
  7. */
  8. namespace Gedmo\Loggable\Entity\MappedSuperclass;
  9. use Doctrine\DBAL\Types\Types;
  10. use Doctrine\ORM\Mapping as ORM;
  11. use Gedmo\Loggable\LogEntryInterface;
  12. use Gedmo\Loggable\Loggable;
  13. /**
  14. * @phpstan-template T of Loggable|object
  15. *
  16. * @phpstan-implements LogEntryInterface<T>
  17. *
  18. * @ORM\MappedSuperclass
  19. */
  20. #[ORM\MappedSuperclass]
  21. abstract class AbstractLogEntry implements LogEntryInterface
  22. {
  23. /**
  24. * @var int|null
  25. *
  26. * @ORM\Column(type="integer")
  27. * @ORM\Id
  28. * @ORM\GeneratedValue
  29. */
  30. #[ORM\Column(type: Types::INTEGER)]
  31. #[ORM\Id]
  32. #[ORM\GeneratedValue]
  33. protected $id;
  34. /**
  35. * @var string|null
  36. *
  37. * @phpstan-var self::ACTION_CREATE|self::ACTION_UPDATE|self::ACTION_REMOVE|null
  38. *
  39. * @ORM\Column(type="string", length=8)
  40. */
  41. #[ORM\Column(type: Types::STRING, length: 8)]
  42. protected $action;
  43. /**
  44. * @var \DateTime|null
  45. *
  46. * @ORM\Column(name="logged_at", type="datetime")
  47. */
  48. #[ORM\Column(name: 'logged_at', type: Types::DATETIME_MUTABLE)]
  49. protected $loggedAt;
  50. /**
  51. * @var string|null
  52. *
  53. * @ORM\Column(name="object_id", length=64, nullable=true)
  54. */
  55. #[ORM\Column(name: 'object_id', length: 64, nullable: true)]
  56. protected $objectId;
  57. /**
  58. * @var string|null
  59. *
  60. * @phpstan-var class-string<T>|null
  61. *
  62. * @ORM\Column(name="object_class", type="string", length=191)
  63. */
  64. #[ORM\Column(name: 'object_class', type: Types::STRING, length: 191)]
  65. protected $objectClass;
  66. /**
  67. * @var int|null
  68. *
  69. * @ORM\Column(type="integer")
  70. */
  71. #[ORM\Column(type: Types::INTEGER)]
  72. protected $version;
  73. /**
  74. * @var array<string, mixed>|null
  75. *
  76. * @ORM\Column(type="array", nullable=true)
  77. *
  78. * NOTE: The attribute uses the "array" name directly instead of the constant since it was removed in DBAL 4.0.
  79. */
  80. #[ORM\Column(type: 'array', nullable: true)]
  81. protected $data;
  82. /**
  83. * @var string|null
  84. *
  85. * @ORM\Column(length=191, nullable=true)
  86. */
  87. #[ORM\Column(length: 191, nullable: true)]
  88. protected $username;
  89. /**
  90. * Get id
  91. *
  92. * @return int|null
  93. */
  94. public function getId()
  95. {
  96. return $this->id;
  97. }
  98. /**
  99. * Get action
  100. */
  101. public function getAction()
  102. {
  103. return $this->action;
  104. }
  105. /**
  106. * Set action
  107. */
  108. public function setAction($action)
  109. {
  110. $this->action = $action;
  111. }
  112. /**
  113. * Get object class
  114. */
  115. public function getObjectClass()
  116. {
  117. return $this->objectClass;
  118. }
  119. /**
  120. * Set object class
  121. */
  122. public function setObjectClass($objectClass)
  123. {
  124. $this->objectClass = $objectClass;
  125. }
  126. /**
  127. * Get object id
  128. */
  129. public function getObjectId()
  130. {
  131. return $this->objectId;
  132. }
  133. /**
  134. * Set object id
  135. *
  136. * @param string $objectId
  137. */
  138. public function setObjectId($objectId)
  139. {
  140. $this->objectId = $objectId;
  141. }
  142. /**
  143. * Get username
  144. */
  145. public function getUsername()
  146. {
  147. return $this->username;
  148. }
  149. /**
  150. * Set username
  151. *
  152. * @param string $username
  153. */
  154. public function setUsername($username)
  155. {
  156. $this->username = $username;
  157. }
  158. /**
  159. * Get loggedAt
  160. */
  161. public function getLoggedAt()
  162. {
  163. return $this->loggedAt;
  164. }
  165. /**
  166. * Set loggedAt to "now"
  167. */
  168. public function setLoggedAt()
  169. {
  170. $this->loggedAt = new \DateTime();
  171. }
  172. /**
  173. * Get data
  174. */
  175. public function getData()
  176. {
  177. return $this->data;
  178. }
  179. /**
  180. * Set data
  181. */
  182. public function setData($data)
  183. {
  184. $this->data = $data;
  185. }
  186. /**
  187. * Set current version
  188. *
  189. * @param int $version
  190. */
  191. public function setVersion($version)
  192. {
  193. $this->version = $version;
  194. }
  195. /**
  196. * Get current version
  197. */
  198. public function getVersion()
  199. {
  200. return $this->version;
  201. }
  202. }