src/App/Entity/SearchEvent.php line 22

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Utility\GuidUtility;
  4. use App\Validator\Constraint as AppAssert;
  5. use DateTime;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Exception;
  8. /**
  9. * @ORM\Entity
  10. *
  11. * @ORM\Table(
  12. * name="search_events",
  13. * indexes={
  14. *
  15. * @ORM\Index(name="occured_at_idx", columns={"occured_at"})
  16. * }
  17. * )
  18. */
  19. class SearchEvent
  20. {
  21. public const SEARCH_TYPE_WANTED_JOBS_SEARCH = 0;
  22. public const SEARCH_TYPE_RECURRENT_JOBS_SEARCH = 1;
  23. public function __construct()
  24. {
  25. $this->affectedUserIsJobofferer = false;
  26. $this->affectedUserIsJobseeker = false;
  27. $this->isProbablyBotRequest = null;
  28. }
  29. /**
  30. * @var string
  31. *
  32. * @ORM\GeneratedValue(strategy="CUSTOM")
  33. *
  34. * @ORM\CustomIdGenerator(class="App\Utility\DatabaseIdGenerator")
  35. *
  36. * @ORM\Column(name="id", type="guid")
  37. *
  38. * @ORM\Id
  39. */
  40. protected $id;
  41. public function setId(string $id): void
  42. {
  43. GuidUtility::validOrThrow($id);
  44. $this->id = $id;
  45. }
  46. public function getId(): ?string
  47. {
  48. return $this->id;
  49. }
  50. /**
  51. * @var DateTime
  52. *
  53. * @ORM\Column(name="occured_at", type="datetime", nullable=false)
  54. */
  55. protected $occuredAt;
  56. public function setOccuredAt(DateTime $occuredAt): void
  57. {
  58. $this->occuredAt = $occuredAt;
  59. }
  60. public function getOccuredAt(): DateTime
  61. {
  62. return $this->occuredAt;
  63. }
  64. /**
  65. * @ORM\Column(name="affected_user_id", type="guid", nullable=true)
  66. *
  67. * We don't make this a foreign key on purpose, we don't need the integrity and don't want to delete event data
  68. * if a user is deleted.
  69. */
  70. protected $affectedUserId;
  71. public function setAffectedUserId(?string $userId = null): void
  72. {
  73. GuidUtility::validOrThrow($userId, true);
  74. $this->affectedUserId = $userId;
  75. }
  76. public function getAffectedUserId(): ?string
  77. {
  78. return $this->affectedUserId;
  79. }
  80. /**
  81. * @ORM\Column(name="affected_user_is_jobofferer", type="boolean", nullable=false)
  82. */
  83. protected $affectedUserIsJobofferer;
  84. public function setAffectedUserIsJobofferer(bool $affectedUserIsJobofferer): void
  85. {
  86. $this->affectedUserIsJobofferer = $affectedUserIsJobofferer;
  87. }
  88. public function getAffectedUserIsJobofferer(): bool
  89. {
  90. return $this->affectedUserIsJobofferer;
  91. }
  92. /**
  93. * @ORM\Column(name="affected_user_is_jobseeker", type="boolean", nullable=false)
  94. */
  95. protected $affectedUserIsJobseeker;
  96. public function setAffectedUserIsJobseeker(bool $affectedUserIsJobseeker): void
  97. {
  98. $this->affectedUserIsJobseeker = $affectedUserIsJobseeker;
  99. }
  100. public function getAffectedUserIsJobseeker(): bool
  101. {
  102. return $this->affectedUserIsJobseeker;
  103. }
  104. /**
  105. * @ORM\Column(name="affected_user_registered_at", type="datetime", nullable=true)
  106. *
  107. * In order to show statistics related to the cohorte of all users registered on day X, we need this field
  108. *
  109. * E.g. "from all user registered on 2018-04-07, how many ran into error X?"
  110. */
  111. protected $affectedUserRegisteredAt;
  112. public function setAffectedUserRegisteredAt(?DateTime $affectedUserRegisteredAt = null): void
  113. {
  114. $this->affectedUserRegisteredAt = $affectedUserRegisteredAt;
  115. }
  116. public function getAffectedUserRegisteredAt(): ?DateTime
  117. {
  118. return $this->affectedUserRegisteredAt;
  119. }
  120. /**
  121. * @ORM\Column(name="search_type", type="smallint", nullable=false)
  122. */
  123. protected $searchType;
  124. public function setSearchType(int $searchType): void
  125. {
  126. $this->searchType = $searchType;
  127. }
  128. public function getSearchType(): int
  129. {
  130. return $this->searchType;
  131. }
  132. /**
  133. * @ORM\Column(name="admin_user_id", type="guid", nullable=true)
  134. *
  135. * We don't make this a foreign key on purpose, we don't need the integrity and don't want to delete event data
  136. * if a user is deleted.
  137. */
  138. protected $adminUserId;
  139. public function setAdminUserId(?string $adminUserId = null): void
  140. {
  141. GuidUtility::validOrThrow($adminUserId, true);
  142. $this->adminUserId = $adminUserId;
  143. }
  144. public function getAdminUserId(): ?string
  145. {
  146. return $this->adminUserId;
  147. }
  148. /**
  149. * @var string|null
  150. *
  151. * @ORM\Column(name="filter_occupational_fields", type="text", length=128, nullable=true)
  152. */
  153. protected $filterOccupationalFields;
  154. public function getFilterOccupationalFields(): ?string
  155. {
  156. return $this->filterOccupationalFields;
  157. }
  158. /** @throws Exception */
  159. public function setFilterOccupationalFields(?string $filterOccupationalFields): void
  160. {
  161. if (is_null($filterOccupationalFields)) {
  162. $this->filterOccupationalFields = $filterOccupationalFields;
  163. return;
  164. }
  165. preg_match('/(\d,?)+/', $filterOccupationalFields, $matches);
  166. if (is_array($matches)
  167. && sizeof($matches) >= 1
  168. && $matches[0] === $filterOccupationalFields
  169. ) {
  170. $this->filterOccupationalFields = $filterOccupationalFields;
  171. } else {
  172. throw new Exception("Not a valid filterOccupationalFields string: '$filterOccupationalFields'.");
  173. }
  174. }
  175. /**
  176. * @ORM\Column(name="filter_zipcode_radius", type="integer", nullable=false)
  177. */
  178. protected $filterZipcodeRadius;
  179. public function getFilterZipcodeRadius(): int
  180. {
  181. return $this->filterZipcodeRadius;
  182. }
  183. public function setFilterZipcodeRadius(int $filterZipcodeRadius): void
  184. {
  185. $this->filterZipcodeRadius = $filterZipcodeRadius;
  186. }
  187. /**
  188. * @ORM\Column(name="filter_zipcode", type="string", nullable=false)
  189. *
  190. * @AppAssert\KnownZipcode
  191. */
  192. protected $filterZipcode;
  193. public function getFilterZipcode(): string
  194. {
  195. return $this->filterZipcode;
  196. }
  197. public function setFilterZipcode(string $filterZipcode): void
  198. {
  199. $this->filterZipcode = $filterZipcode;
  200. }
  201. /**
  202. * @ORM\Column(name="filter_experience", type="smallint", nullable=false)
  203. */
  204. protected $filterExperience;
  205. public function getFilterExperience(): int
  206. {
  207. return $this->filterExperience;
  208. }
  209. public function setFilterExperience(string $filterExperience): void
  210. {
  211. $this->filterExperience = $filterExperience;
  212. }
  213. /**
  214. * @ORM\Column(name="filter_monday_morning", type="boolean", nullable=false)
  215. */
  216. protected $filterMondayMorning;
  217. public function getFilterMondayMorning(): bool
  218. {
  219. return $this->filterMondayMorning;
  220. }
  221. public function setFilterMondayMorning(bool $filterMondayMorning): void
  222. {
  223. $this->filterMondayMorning = $filterMondayMorning;
  224. }
  225. /**
  226. * @ORM\Column(name="filter_monday_noon", type="boolean", nullable=false)
  227. */
  228. protected $filterMondayNoon;
  229. public function getFilterMondayNoon(): bool
  230. {
  231. return $this->filterMondayNoon;
  232. }
  233. public function setFilterMondayNoon(bool $filterMondayNoon): void
  234. {
  235. $this->filterMondayNoon = $filterMondayNoon;
  236. }
  237. /**
  238. * @ORM\Column(name="filter_monday_evening", type="boolean", nullable=false)
  239. */
  240. protected $filterMondayEvening;
  241. public function getFilterMondayEvening(): bool
  242. {
  243. return $this->filterMondayEvening;
  244. }
  245. public function setFilterMondayEvening(bool $filterMondayEvening): void
  246. {
  247. $this->filterMondayEvening = $filterMondayEvening;
  248. }
  249. /**
  250. * @ORM\Column(name="filter_monday_night", type="boolean", nullable=false)
  251. */
  252. protected $filterMondayNight;
  253. public function getFilterMondayNight(): bool
  254. {
  255. return $this->filterMondayNight;
  256. }
  257. public function setFilterMondayNight(bool $filterMondayNight): void
  258. {
  259. $this->filterMondayNight = $filterMondayNight;
  260. }
  261. /**
  262. * @ORM\Column(name="filter_tuesday_morning", type="boolean", nullable=false)
  263. */
  264. protected $filterTuesdayMorning;
  265. public function getFilterTuesdayMorning(): bool
  266. {
  267. return $this->filterTuesdayMorning;
  268. }
  269. public function setFilterTuesdayMorning(bool $filterTuesdayMorning): void
  270. {
  271. $this->filterTuesdayMorning = $filterTuesdayMorning;
  272. }
  273. /**
  274. * @ORM\Column(name="filter_tuesday_noon", type="boolean", nullable=false)
  275. */
  276. protected $filterTuesdayNoon;
  277. public function getFilterTuesdayNoon(): bool
  278. {
  279. return $this->filterTuesdayNoon;
  280. }
  281. public function setFilterTuesdayNoon(bool $filterTuesdayNoon): void
  282. {
  283. $this->filterTuesdayNoon = $filterTuesdayNoon;
  284. }
  285. /**
  286. * @ORM\Column(name="filter_tuesday_evening", type="boolean", nullable=false)
  287. */
  288. protected $filterTuesdayEvening;
  289. public function getFilterTuesdayEvening(): bool
  290. {
  291. return $this->filterTuesdayEvening;
  292. }
  293. public function setFilterTuesdayEvening(bool $filterTuesdayEvening): void
  294. {
  295. $this->filterTuesdayEvening = $filterTuesdayEvening;
  296. }
  297. /**
  298. * @ORM\Column(name="filter_tuesday_night", type="boolean", nullable=false)
  299. */
  300. protected $filterTuesdayNight;
  301. public function getFilterTuesdayNight(): bool
  302. {
  303. return $this->filterTuesdayNight;
  304. }
  305. public function setFilterTuesdayNight(bool $filterTuesdayNight): void
  306. {
  307. $this->filterTuesdayNight = $filterTuesdayNight;
  308. }
  309. /**
  310. * @ORM\Column(name="filter_wednesday_morning", type="boolean", nullable=false)
  311. */
  312. protected $filterWednesdayMorning;
  313. public function getFilterWednesdayMorning(): bool
  314. {
  315. return $this->filterWednesdayMorning;
  316. }
  317. public function setFilterWednesdayMorning(bool $filterWednesdayMorning): void
  318. {
  319. $this->filterWednesdayMorning = $filterWednesdayMorning;
  320. }
  321. /**
  322. * @ORM\Column(name="filter_wednesday_noon", type="boolean", nullable=false)
  323. */
  324. protected $filterWednesdayNoon;
  325. public function getFilterWednesdayNoon(): bool
  326. {
  327. return $this->filterWednesdayNoon;
  328. }
  329. public function setFilterWednesdayNoon(bool $filterWednesdayNoon): void
  330. {
  331. $this->filterWednesdayNoon = $filterWednesdayNoon;
  332. }
  333. /**
  334. * @ORM\Column(name="filter_wednesday_evening", type="boolean", nullable=false)
  335. */
  336. protected $filterWednesdayEvening;
  337. public function getFilterWednesdayEvening(): bool
  338. {
  339. return $this->filterWednesdayEvening;
  340. }
  341. public function setFilterWednesdayEvening(bool $filterWednesdayEvening): void
  342. {
  343. $this->filterWednesdayEvening = $filterWednesdayEvening;
  344. }
  345. /**
  346. * @ORM\Column(name="filter_wednesday_night", type="boolean", nullable=false)
  347. */
  348. protected $filterWednesdayNight;
  349. public function getFilterWednesdayNight(): bool
  350. {
  351. return $this->filterWednesdayNight;
  352. }
  353. public function setFilterWednesdayNight(bool $filterWednesdayNight): void
  354. {
  355. $this->filterWednesdayNight = $filterWednesdayNight;
  356. }
  357. /**
  358. * @ORM\Column(name="filter_thursday_morning", type="boolean", nullable=false)
  359. */
  360. protected $filterThursdayMorning;
  361. public function getFilterThursdayMorning(): bool
  362. {
  363. return $this->filterThursdayMorning;
  364. }
  365. public function setFilterThursdayMorning(bool $filterThursdayMorning): void
  366. {
  367. $this->filterThursdayMorning = $filterThursdayMorning;
  368. }
  369. /**
  370. * @ORM\Column(name="filter_thursday_noon", type="boolean", nullable=false)
  371. */
  372. protected $filterThursdayNoon;
  373. public function getFilterThursdayNoon(): bool
  374. {
  375. return $this->filterThursdayNoon;
  376. }
  377. public function setFilterThursdayNoon(bool $filterThursdayNoon): void
  378. {
  379. $this->filterThursdayNoon = $filterThursdayNoon;
  380. }
  381. /**
  382. * @ORM\Column(name="filter_thursday_evening", type="boolean", nullable=false)
  383. */
  384. protected $filterThursdayEvening;
  385. public function getFilterThursdayEvening(): bool
  386. {
  387. return $this->filterThursdayEvening;
  388. }
  389. public function setFilterThursdayEvening(bool $filterThursdayEvening): void
  390. {
  391. $this->filterThursdayEvening = $filterThursdayEvening;
  392. }
  393. /**
  394. * @ORM\Column(name="filter_thursday_night", type="boolean", nullable=false)
  395. */
  396. protected $filterThursdayNight;
  397. public function getFilterThursdayNight(): bool
  398. {
  399. return $this->filterThursdayNight;
  400. }
  401. public function setFilterThursdayNight(bool $filterThursdayNight): void
  402. {
  403. $this->filterThursdayNight = $filterThursdayNight;
  404. }
  405. /**
  406. * @ORM\Column(name="filter_friday_morning", type="boolean", nullable=false)
  407. */
  408. protected $filterFridayMorning;
  409. public function getFilterFridayMorning(): bool
  410. {
  411. return $this->filterFridayMorning;
  412. }
  413. public function setFilterFridayMorning(bool $filterFridayMorning): void
  414. {
  415. $this->filterFridayMorning = $filterFridayMorning;
  416. }
  417. /**
  418. * @ORM\Column(name="filter_friday_noon", type="boolean", nullable=false)
  419. */
  420. protected $filterFridayNoon;
  421. public function getFilterFridayNoon(): bool
  422. {
  423. return $this->filterFridayNoon;
  424. }
  425. public function setFilterFridayNoon(bool $filterFridayNoon): void
  426. {
  427. $this->filterFridayNoon = $filterFridayNoon;
  428. }
  429. /**
  430. * @ORM\Column(name="filter_friday_evening", type="boolean", nullable=false)
  431. */
  432. protected $filterFridayEvening;
  433. public function getFilterFridayEvening(): bool
  434. {
  435. return $this->filterFridayEvening;
  436. }
  437. public function setFilterFridayEvening(bool $filterFridayEvening): void
  438. {
  439. $this->filterFridayEvening = $filterFridayEvening;
  440. }
  441. /**
  442. * @ORM\Column(name="filter_friday_night", type="boolean", nullable=false)
  443. */
  444. protected $filterFridayNight;
  445. public function getFilterFridayNight(): bool
  446. {
  447. return $this->filterFridayNight;
  448. }
  449. public function setFilterFridayNight(bool $filterFridayNight): void
  450. {
  451. $this->filterFridayNight = $filterFridayNight;
  452. }
  453. /**
  454. * @ORM\Column(name="filter_saturday_morning", type="boolean", nullable=false)
  455. */
  456. protected $filterSaturdayMorning;
  457. public function getFilterSaturdayMorning(): bool
  458. {
  459. return $this->filterSaturdayMorning;
  460. }
  461. public function setFilterSaturdayMorning(bool $filterSaturdayMorning): void
  462. {
  463. $this->filterSaturdayMorning = $filterSaturdayMorning;
  464. }
  465. /**
  466. * @ORM\Column(name="filter_saturday_noon", type="boolean", nullable=false)
  467. */
  468. protected $filterSaturdayNoon;
  469. public function getFilterSaturdayNoon(): bool
  470. {
  471. return $this->filterSaturdayNoon;
  472. }
  473. public function setFilterSaturdayNoon(bool $filterSaturdayNoon): void
  474. {
  475. $this->filterSaturdayNoon = $filterSaturdayNoon;
  476. }
  477. /**
  478. * @ORM\Column(name="filter_saturday_evening", type="boolean", nullable=false)
  479. */
  480. protected $filterSaturdayEvening;
  481. public function getFilterSaturdayEvening(): bool
  482. {
  483. return $this->filterSaturdayEvening;
  484. }
  485. public function setFilterSaturdayEvening(bool $filterSaturdayEvening): void
  486. {
  487. $this->filterSaturdayEvening = $filterSaturdayEvening;
  488. }
  489. /**
  490. * @ORM\Column(name="filter_saturday_night", type="boolean", nullable=false)
  491. */
  492. protected $filterSaturdayNight;
  493. public function getFilterSaturdayNight(): bool
  494. {
  495. return $this->filterSaturdayNight;
  496. }
  497. public function setFilterSaturdayNight(bool $filterSaturdayNight): void
  498. {
  499. $this->filterSaturdayNight = $filterSaturdayNight;
  500. }
  501. /**
  502. * @ORM\Column(name="filter_sunday_morning", type="boolean", nullable=false)
  503. */
  504. protected $filterSundayMorning;
  505. public function getFilterSundayMorning(): bool
  506. {
  507. return $this->filterSundayMorning;
  508. }
  509. public function setFilterSundayMorning(bool $filterSundayMorning): void
  510. {
  511. $this->filterSundayMorning = $filterSundayMorning;
  512. }
  513. /**
  514. * @ORM\Column(name="filter_sunday_noon", type="boolean", nullable=false)
  515. */
  516. protected $filterSundayNoon;
  517. public function getFilterSundayNoon(): bool
  518. {
  519. return $this->filterSundayNoon;
  520. }
  521. public function setFilterSundayNoon(bool $filterSundayNoon): void
  522. {
  523. $this->filterSundayNoon = $filterSundayNoon;
  524. }
  525. /**
  526. * @ORM\Column(name="filter_sunday_evening", type="boolean", nullable=false)
  527. */
  528. protected $filterSundayEvening;
  529. public function getFilterSundayEvening(): bool
  530. {
  531. return $this->filterSundayEvening;
  532. }
  533. public function setFilterSundayEvening(bool $filterSundayEvening): void
  534. {
  535. $this->filterSundayEvening = $filterSundayEvening;
  536. }
  537. /**
  538. * @ORM\Column(name="filter_sunday_night", type="boolean", nullable=false)
  539. */
  540. protected $filterSundayNight;
  541. public function getFilterSundayNight(): bool
  542. {
  543. return $this->filterSundayNight;
  544. }
  545. public function setFilterSundayNight(bool $filterSundayNight): void
  546. {
  547. $this->filterSundayNight = $filterSundayNight;
  548. }
  549. /**
  550. * @ORM\Column(name="request_id", type="text", length=256, nullable=true)
  551. */
  552. protected $requestId;
  553. public function setRequestId(?string $requestId = null): void
  554. {
  555. $this->requestId = $requestId;
  556. }
  557. public function getRequestId(): ?string
  558. {
  559. return $this->requestId;
  560. }
  561. /**
  562. * @ORM\Column(name="session_id", type="text", length=256, nullable=true)
  563. */
  564. protected $sessionId;
  565. public function setSessionId(?string $sessionId = null): void
  566. {
  567. $this->sessionId = $sessionId;
  568. }
  569. public function getSessionId(): ?string
  570. {
  571. return $this->sessionId;
  572. }
  573. /**
  574. * @ORM\Column(name="client_id", type="text", length=64, nullable=true)
  575. */
  576. protected $clientId;
  577. public function setClientId(?string $clientId = null): void
  578. {
  579. $this->clientId = $clientId;
  580. }
  581. public function getClientId(): ?string
  582. {
  583. return $this->clientId;
  584. }
  585. /**
  586. * @ORM\Column(name="is_probably_bot_request", type="boolean", nullable=true)
  587. */
  588. private ?bool $isProbablyBotRequest;
  589. public function getIsProbablyBotRequest(): ?bool
  590. {
  591. return $this->isProbablyBotRequest;
  592. }
  593. public function setIsProbablyBotRequest(?bool $isProbablyBotRequest): void
  594. {
  595. $this->isProbablyBotRequest = $isProbablyBotRequest;
  596. }
  597. }