src/App/Entity/WebrequestEvent.php line 21

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Utility\GuidUtility;
  4. use DateTime;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Exception;
  7. /**
  8. * @ORM\Entity
  9. *
  10. * @ORM\Table(
  11. * name="webrequest_events",
  12. * indexes={
  13. *
  14. * @ORM\Index(name="occured_at_idx", columns={"occured_at"})
  15. * }
  16. * )
  17. */
  18. class WebrequestEvent
  19. {
  20. /**
  21. * @var string
  22. *
  23. * @ORM\GeneratedValue(strategy="CUSTOM")
  24. *
  25. * @ORM\CustomIdGenerator(class="App\Utility\DatabaseIdGenerator")
  26. *
  27. * @ORM\Column(name="id", type="guid")
  28. *
  29. * @ORM\Id
  30. */
  31. protected $id;
  32. public function setId(string $id): void
  33. {
  34. GuidUtility::validOrThrow($id);
  35. $this->id = $id;
  36. }
  37. public function getId(): ?string
  38. {
  39. return $this->id;
  40. }
  41. /**
  42. * @var DateTime
  43. *
  44. * @ORM\Column(name="occured_at", type="datetime", nullable=false)
  45. */
  46. protected $occuredAt;
  47. public function setOccuredAt(DateTime $occuredAt): void
  48. {
  49. $this->occuredAt = $occuredAt;
  50. }
  51. public function getOccuredAt(): DateTime
  52. {
  53. return $this->occuredAt;
  54. }
  55. /**
  56. * @ORM\Column(name="affected_user_id", type="guid", nullable=true)
  57. *
  58. * We don't make this a foreign key on purpose, we don't need the integrity and don't want to delete event data
  59. * if a user is deleted.
  60. */
  61. protected $affectedUserId;
  62. public function setAffectedUserId(?string $userId = null): void
  63. {
  64. GuidUtility::validOrThrow($userId, true);
  65. $this->affectedUserId = $userId;
  66. }
  67. public function getAffectedUserId(): ?string
  68. {
  69. return $this->affectedUserId;
  70. }
  71. /**
  72. * @ORM\Column(name="admin_user_id", type="guid", nullable=true)
  73. *
  74. * We don't make this a foreign key on purpose, we don't need the integrity and don't want to delete event data
  75. * if a user is deleted.
  76. */
  77. protected $adminUserId;
  78. public function setAdminUserId(?string $adminUserId = null): void
  79. {
  80. GuidUtility::validOrThrow($adminUserId, true);
  81. $this->adminUserId = $adminUserId;
  82. }
  83. public function getAdminUserId(): ?string
  84. {
  85. return $this->adminUserId;
  86. }
  87. /**
  88. * @ORM\Column(name="affected_user_is_jobofferer", type="boolean", nullable=true)
  89. */
  90. protected $affectedUserIsJobofferer;
  91. public function setAffectedUserIsJobofferer(?bool $affectedUserIsJobofferer): void
  92. {
  93. $this->affectedUserIsJobofferer = $affectedUserIsJobofferer;
  94. }
  95. public function getAffectedUserIsJobofferer(): ?bool
  96. {
  97. return $this->affectedUserIsJobofferer;
  98. }
  99. /**
  100. * @ORM\Column(name="affected_user_is_jobseeker", type="boolean", nullable=true)
  101. */
  102. protected $affectedUserIsJobseeker;
  103. public function setAffectedUserIsJobseeker(?bool $affectedUserIsJobseeker): void
  104. {
  105. $this->affectedUserIsJobseeker = $affectedUserIsJobseeker;
  106. }
  107. public function getAffectedUserIsJobseeker(): ?bool
  108. {
  109. return $this->affectedUserIsJobseeker;
  110. }
  111. /**
  112. * @ORM\Column(name="affected_user_registered_at", type="datetime", nullable=true)
  113. *
  114. * In order to show statistics related to the cohorte of all users registered on day X, we need this field
  115. *
  116. * E.g. "from all user registered on 2018-04-07, how many ran into error X?"
  117. */
  118. protected $affectedUserRegisteredAt;
  119. public function setAffectedUserRegisteredAt(?DateTime $affectedUserRegisteredAt = null): void
  120. {
  121. $this->affectedUserRegisteredAt = $affectedUserRegisteredAt;
  122. }
  123. public function getAffectedUserRegisteredAt(): ?DateTime
  124. {
  125. return $this->affectedUserRegisteredAt;
  126. }
  127. /**
  128. * @ORM\Column(name="starttime", type="float", nullable=true)
  129. */
  130. protected $starttime;
  131. public function setStarttime(?float $starttime): void
  132. {
  133. $this->starttime = $starttime;
  134. }
  135. public function getStarttime(): ?float
  136. {
  137. return $this->starttime;
  138. }
  139. /**
  140. * @ORM\Column(name="endtime", type="float", nullable=true)
  141. */
  142. protected $endtime;
  143. public function setEndtime(float $endtime): void
  144. {
  145. $this->endtime = $endtime;
  146. }
  147. public function getEndtime(): float
  148. {
  149. return $this->endtime;
  150. }
  151. /**
  152. * @ORM\Column(name="statuscode", type="integer", nullable=false)
  153. */
  154. protected $statuscode;
  155. public function setStatuscode(int $statuscode): void
  156. {
  157. $this->statuscode = $statuscode;
  158. }
  159. public function getStatuscode(): int
  160. {
  161. return $this->statuscode;
  162. }
  163. /**
  164. * @ORM\Column(name="request_method", type="text", length=16384, nullable=false)
  165. */
  166. protected $requestMethod;
  167. public function setRequestMethod(string $requestMethod): void
  168. {
  169. $this->requestMethod = $requestMethod;
  170. }
  171. public function getRequestMethod(): string
  172. {
  173. return $this->requestMethod;
  174. }
  175. /**
  176. * @ORM\Column(name="request_uri", type="text", length=16384, nullable=false)
  177. */
  178. protected $requestUri;
  179. public function setRequestUri(string $requestUri): void
  180. {
  181. $this->requestUri = $requestUri;
  182. }
  183. public function getRequestUri(): string
  184. {
  185. return $this->requestUri;
  186. }
  187. /**
  188. * @ORM\Column(name="query_string", type="text", length=16384, nullable=true)
  189. */
  190. protected $queryString;
  191. public function setQueryString(?string $queryString = null): void
  192. {
  193. $this->queryString = $queryString;
  194. }
  195. public function getQueryString(): ?string
  196. {
  197. return $this->queryString;
  198. }
  199. /**
  200. * @ORM\Column(name="referer", type="text", length=16384, nullable=true)
  201. */
  202. protected $referer;
  203. public function setReferer(?string $referer = null): void
  204. {
  205. $this->referer = $referer;
  206. }
  207. public function getReferer(): ?string
  208. {
  209. return $this->referer;
  210. }
  211. /**
  212. * @ORM\Column(name="request_headers", type="text", length=32768, nullable=false)
  213. */
  214. protected $requestHeaders;
  215. /**
  216. * @throws Exception
  217. */
  218. public function setRequestHeaders(string $requestHeaders): void
  219. {
  220. if (!is_null($requestHeaders)) {
  221. if (is_null(json_decode($requestHeaders))) {
  222. throw new Exception('requestHeaders must be valid JSON');
  223. }
  224. }
  225. $this->requestHeaders = $requestHeaders;
  226. }
  227. public function getRequestHeaders(): string
  228. {
  229. return $this->requestHeaders;
  230. }
  231. /**
  232. * @ORM\Column(name="response_headers", type="text", length=32768, nullable=false)
  233. */
  234. protected $responseHeaders;
  235. /**
  236. * @throws Exception
  237. */
  238. public function setResponseHeaders(string $responseHeaders): void
  239. {
  240. if (!is_null($responseHeaders)) {
  241. if (is_null(json_decode($responseHeaders))) {
  242. throw new Exception('responseHeaders must be valid JSON');
  243. }
  244. }
  245. $this->responseHeaders = $responseHeaders;
  246. }
  247. public function getResponseHeaders(): string
  248. {
  249. return $this->responseHeaders;
  250. }
  251. /**
  252. * @ORM\Column(name="symfony_route", type="text", length=2048, nullable=true)
  253. */
  254. protected $symfonyRoute;
  255. public function setSymfonyRoute(?string $symfonyRoute = null): void
  256. {
  257. $this->symfonyRoute = $symfonyRoute;
  258. }
  259. public function getSymfonyRoute(): ?string
  260. {
  261. return $this->symfonyRoute;
  262. }
  263. /**
  264. * @ORM\Column(name="request_id", type="text", length=256, nullable=true)
  265. */
  266. protected $requestId;
  267. public function setRequestId(?string $requestId = null): void
  268. {
  269. $this->requestId = $requestId;
  270. }
  271. public function getRequestId(): ?string
  272. {
  273. return $this->requestId;
  274. }
  275. /**
  276. * @ORM\Column(name="session_id", type="text", length=256, nullable=true)
  277. */
  278. protected $sessionId;
  279. public function setSessionId(?string $sessionId = null): void
  280. {
  281. $this->sessionId = $sessionId;
  282. }
  283. public function getSessionId(): ?string
  284. {
  285. return $this->sessionId;
  286. }
  287. /**
  288. * @ORM\Column(name="client_id", type="text", length=64, nullable=true)
  289. */
  290. protected $clientId;
  291. public function setClientId(?string $clientId = null): void
  292. {
  293. $this->clientId = $clientId;
  294. }
  295. public function getClientId(): ?string
  296. {
  297. return $this->clientId;
  298. }
  299. /**
  300. * @ORM\Column(name="client_ip_address", type="text", length=64, nullable=false)
  301. */
  302. private string $clientIp;
  303. /**
  304. * @ORM\Column(name="is_probably_bot_request", type="boolean", nullable=true)
  305. */
  306. private ?bool $isProbablyBotRequest = null;
  307. }