<?php
namespace App\Entity;
use App\Utility\GuidUtility;
use App\Validator\Constraint as AppAssert;
use DateTime;
use Doctrine\ORM\Mapping as ORM;
use Exception;
/**
* @ORM\Entity
*
* @ORM\Table(
* name="search_events",
* indexes={
*
* @ORM\Index(name="occured_at_idx", columns={"occured_at"})
* }
* )
*/
class SearchEvent
{
public const SEARCH_TYPE_WANTED_JOBS_SEARCH = 0;
public const SEARCH_TYPE_RECURRENT_JOBS_SEARCH = 1;
public function __construct()
{
$this->affectedUserIsJobofferer = false;
$this->affectedUserIsJobseeker = false;
$this->isProbablyBotRequest = null;
}
/**
* @var string
*
* @ORM\GeneratedValue(strategy="CUSTOM")
*
* @ORM\CustomIdGenerator(class="App\Utility\DatabaseIdGenerator")
*
* @ORM\Column(name="id", type="guid")
*
* @ORM\Id
*/
protected $id;
public function setId(string $id): void
{
GuidUtility::validOrThrow($id);
$this->id = $id;
}
public function getId(): ?string
{
return $this->id;
}
/**
* @var DateTime
*
* @ORM\Column(name="occured_at", type="datetime", nullable=false)
*/
protected $occuredAt;
public function setOccuredAt(DateTime $occuredAt): void
{
$this->occuredAt = $occuredAt;
}
public function getOccuredAt(): DateTime
{
return $this->occuredAt;
}
/**
* @ORM\Column(name="affected_user_id", type="guid", nullable=true)
*
* We don't make this a foreign key on purpose, we don't need the integrity and don't want to delete event data
* if a user is deleted.
*/
protected $affectedUserId;
public function setAffectedUserId(?string $userId = null): void
{
GuidUtility::validOrThrow($userId, true);
$this->affectedUserId = $userId;
}
public function getAffectedUserId(): ?string
{
return $this->affectedUserId;
}
/**
* @ORM\Column(name="affected_user_is_jobofferer", type="boolean", nullable=false)
*/
protected $affectedUserIsJobofferer;
public function setAffectedUserIsJobofferer(bool $affectedUserIsJobofferer): void
{
$this->affectedUserIsJobofferer = $affectedUserIsJobofferer;
}
public function getAffectedUserIsJobofferer(): bool
{
return $this->affectedUserIsJobofferer;
}
/**
* @ORM\Column(name="affected_user_is_jobseeker", type="boolean", nullable=false)
*/
protected $affectedUserIsJobseeker;
public function setAffectedUserIsJobseeker(bool $affectedUserIsJobseeker): void
{
$this->affectedUserIsJobseeker = $affectedUserIsJobseeker;
}
public function getAffectedUserIsJobseeker(): bool
{
return $this->affectedUserIsJobseeker;
}
/**
* @ORM\Column(name="affected_user_registered_at", type="datetime", nullable=true)
*
* In order to show statistics related to the cohorte of all users registered on day X, we need this field
*
* E.g. "from all user registered on 2018-04-07, how many ran into error X?"
*/
protected $affectedUserRegisteredAt;
public function setAffectedUserRegisteredAt(?DateTime $affectedUserRegisteredAt = null): void
{
$this->affectedUserRegisteredAt = $affectedUserRegisteredAt;
}
public function getAffectedUserRegisteredAt(): ?DateTime
{
return $this->affectedUserRegisteredAt;
}
/**
* @ORM\Column(name="search_type", type="smallint", nullable=false)
*/
protected $searchType;
public function setSearchType(int $searchType): void
{
$this->searchType = $searchType;
}
public function getSearchType(): int
{
return $this->searchType;
}
/**
* @ORM\Column(name="admin_user_id", type="guid", nullable=true)
*
* We don't make this a foreign key on purpose, we don't need the integrity and don't want to delete event data
* if a user is deleted.
*/
protected $adminUserId;
public function setAdminUserId(?string $adminUserId = null): void
{
GuidUtility::validOrThrow($adminUserId, true);
$this->adminUserId = $adminUserId;
}
public function getAdminUserId(): ?string
{
return $this->adminUserId;
}
/**
* @var string|null
*
* @ORM\Column(name="filter_occupational_fields", type="text", length=128, nullable=true)
*/
protected $filterOccupationalFields;
public function getFilterOccupationalFields(): ?string
{
return $this->filterOccupationalFields;
}
/** @throws Exception */
public function setFilterOccupationalFields(?string $filterOccupationalFields): void
{
if (is_null($filterOccupationalFields)) {
$this->filterOccupationalFields = $filterOccupationalFields;
return;
}
preg_match('/(\d,?)+/', $filterOccupationalFields, $matches);
if (is_array($matches)
&& sizeof($matches) >= 1
&& $matches[0] === $filterOccupationalFields
) {
$this->filterOccupationalFields = $filterOccupationalFields;
} else {
throw new Exception("Not a valid filterOccupationalFields string: '$filterOccupationalFields'.");
}
}
/**
* @ORM\Column(name="filter_zipcode_radius", type="integer", nullable=false)
*/
protected $filterZipcodeRadius;
public function getFilterZipcodeRadius(): int
{
return $this->filterZipcodeRadius;
}
public function setFilterZipcodeRadius(int $filterZipcodeRadius): void
{
$this->filterZipcodeRadius = $filterZipcodeRadius;
}
/**
* @ORM\Column(name="filter_zipcode", type="string", nullable=false)
*
* @AppAssert\KnownZipcode
*/
protected $filterZipcode;
public function getFilterZipcode(): string
{
return $this->filterZipcode;
}
public function setFilterZipcode(string $filterZipcode): void
{
$this->filterZipcode = $filterZipcode;
}
/**
* @ORM\Column(name="filter_experience", type="smallint", nullable=false)
*/
protected $filterExperience;
public function getFilterExperience(): int
{
return $this->filterExperience;
}
public function setFilterExperience(string $filterExperience): void
{
$this->filterExperience = $filterExperience;
}
/**
* @ORM\Column(name="filter_monday_morning", type="boolean", nullable=false)
*/
protected $filterMondayMorning;
public function getFilterMondayMorning(): bool
{
return $this->filterMondayMorning;
}
public function setFilterMondayMorning(bool $filterMondayMorning): void
{
$this->filterMondayMorning = $filterMondayMorning;
}
/**
* @ORM\Column(name="filter_monday_noon", type="boolean", nullable=false)
*/
protected $filterMondayNoon;
public function getFilterMondayNoon(): bool
{
return $this->filterMondayNoon;
}
public function setFilterMondayNoon(bool $filterMondayNoon): void
{
$this->filterMondayNoon = $filterMondayNoon;
}
/**
* @ORM\Column(name="filter_monday_evening", type="boolean", nullable=false)
*/
protected $filterMondayEvening;
public function getFilterMondayEvening(): bool
{
return $this->filterMondayEvening;
}
public function setFilterMondayEvening(bool $filterMondayEvening): void
{
$this->filterMondayEvening = $filterMondayEvening;
}
/**
* @ORM\Column(name="filter_monday_night", type="boolean", nullable=false)
*/
protected $filterMondayNight;
public function getFilterMondayNight(): bool
{
return $this->filterMondayNight;
}
public function setFilterMondayNight(bool $filterMondayNight): void
{
$this->filterMondayNight = $filterMondayNight;
}
/**
* @ORM\Column(name="filter_tuesday_morning", type="boolean", nullable=false)
*/
protected $filterTuesdayMorning;
public function getFilterTuesdayMorning(): bool
{
return $this->filterTuesdayMorning;
}
public function setFilterTuesdayMorning(bool $filterTuesdayMorning): void
{
$this->filterTuesdayMorning = $filterTuesdayMorning;
}
/**
* @ORM\Column(name="filter_tuesday_noon", type="boolean", nullable=false)
*/
protected $filterTuesdayNoon;
public function getFilterTuesdayNoon(): bool
{
return $this->filterTuesdayNoon;
}
public function setFilterTuesdayNoon(bool $filterTuesdayNoon): void
{
$this->filterTuesdayNoon = $filterTuesdayNoon;
}
/**
* @ORM\Column(name="filter_tuesday_evening", type="boolean", nullable=false)
*/
protected $filterTuesdayEvening;
public function getFilterTuesdayEvening(): bool
{
return $this->filterTuesdayEvening;
}
public function setFilterTuesdayEvening(bool $filterTuesdayEvening): void
{
$this->filterTuesdayEvening = $filterTuesdayEvening;
}
/**
* @ORM\Column(name="filter_tuesday_night", type="boolean", nullable=false)
*/
protected $filterTuesdayNight;
public function getFilterTuesdayNight(): bool
{
return $this->filterTuesdayNight;
}
public function setFilterTuesdayNight(bool $filterTuesdayNight): void
{
$this->filterTuesdayNight = $filterTuesdayNight;
}
/**
* @ORM\Column(name="filter_wednesday_morning", type="boolean", nullable=false)
*/
protected $filterWednesdayMorning;
public function getFilterWednesdayMorning(): bool
{
return $this->filterWednesdayMorning;
}
public function setFilterWednesdayMorning(bool $filterWednesdayMorning): void
{
$this->filterWednesdayMorning = $filterWednesdayMorning;
}
/**
* @ORM\Column(name="filter_wednesday_noon", type="boolean", nullable=false)
*/
protected $filterWednesdayNoon;
public function getFilterWednesdayNoon(): bool
{
return $this->filterWednesdayNoon;
}
public function setFilterWednesdayNoon(bool $filterWednesdayNoon): void
{
$this->filterWednesdayNoon = $filterWednesdayNoon;
}
/**
* @ORM\Column(name="filter_wednesday_evening", type="boolean", nullable=false)
*/
protected $filterWednesdayEvening;
public function getFilterWednesdayEvening(): bool
{
return $this->filterWednesdayEvening;
}
public function setFilterWednesdayEvening(bool $filterWednesdayEvening): void
{
$this->filterWednesdayEvening = $filterWednesdayEvening;
}
/**
* @ORM\Column(name="filter_wednesday_night", type="boolean", nullable=false)
*/
protected $filterWednesdayNight;
public function getFilterWednesdayNight(): bool
{
return $this->filterWednesdayNight;
}
public function setFilterWednesdayNight(bool $filterWednesdayNight): void
{
$this->filterWednesdayNight = $filterWednesdayNight;
}
/**
* @ORM\Column(name="filter_thursday_morning", type="boolean", nullable=false)
*/
protected $filterThursdayMorning;
public function getFilterThursdayMorning(): bool
{
return $this->filterThursdayMorning;
}
public function setFilterThursdayMorning(bool $filterThursdayMorning): void
{
$this->filterThursdayMorning = $filterThursdayMorning;
}
/**
* @ORM\Column(name="filter_thursday_noon", type="boolean", nullable=false)
*/
protected $filterThursdayNoon;
public function getFilterThursdayNoon(): bool
{
return $this->filterThursdayNoon;
}
public function setFilterThursdayNoon(bool $filterThursdayNoon): void
{
$this->filterThursdayNoon = $filterThursdayNoon;
}
/**
* @ORM\Column(name="filter_thursday_evening", type="boolean", nullable=false)
*/
protected $filterThursdayEvening;
public function getFilterThursdayEvening(): bool
{
return $this->filterThursdayEvening;
}
public function setFilterThursdayEvening(bool $filterThursdayEvening): void
{
$this->filterThursdayEvening = $filterThursdayEvening;
}
/**
* @ORM\Column(name="filter_thursday_night", type="boolean", nullable=false)
*/
protected $filterThursdayNight;
public function getFilterThursdayNight(): bool
{
return $this->filterThursdayNight;
}
public function setFilterThursdayNight(bool $filterThursdayNight): void
{
$this->filterThursdayNight = $filterThursdayNight;
}
/**
* @ORM\Column(name="filter_friday_morning", type="boolean", nullable=false)
*/
protected $filterFridayMorning;
public function getFilterFridayMorning(): bool
{
return $this->filterFridayMorning;
}
public function setFilterFridayMorning(bool $filterFridayMorning): void
{
$this->filterFridayMorning = $filterFridayMorning;
}
/**
* @ORM\Column(name="filter_friday_noon", type="boolean", nullable=false)
*/
protected $filterFridayNoon;
public function getFilterFridayNoon(): bool
{
return $this->filterFridayNoon;
}
public function setFilterFridayNoon(bool $filterFridayNoon): void
{
$this->filterFridayNoon = $filterFridayNoon;
}
/**
* @ORM\Column(name="filter_friday_evening", type="boolean", nullable=false)
*/
protected $filterFridayEvening;
public function getFilterFridayEvening(): bool
{
return $this->filterFridayEvening;
}
public function setFilterFridayEvening(bool $filterFridayEvening): void
{
$this->filterFridayEvening = $filterFridayEvening;
}
/**
* @ORM\Column(name="filter_friday_night", type="boolean", nullable=false)
*/
protected $filterFridayNight;
public function getFilterFridayNight(): bool
{
return $this->filterFridayNight;
}
public function setFilterFridayNight(bool $filterFridayNight): void
{
$this->filterFridayNight = $filterFridayNight;
}
/**
* @ORM\Column(name="filter_saturday_morning", type="boolean", nullable=false)
*/
protected $filterSaturdayMorning;
public function getFilterSaturdayMorning(): bool
{
return $this->filterSaturdayMorning;
}
public function setFilterSaturdayMorning(bool $filterSaturdayMorning): void
{
$this->filterSaturdayMorning = $filterSaturdayMorning;
}
/**
* @ORM\Column(name="filter_saturday_noon", type="boolean", nullable=false)
*/
protected $filterSaturdayNoon;
public function getFilterSaturdayNoon(): bool
{
return $this->filterSaturdayNoon;
}
public function setFilterSaturdayNoon(bool $filterSaturdayNoon): void
{
$this->filterSaturdayNoon = $filterSaturdayNoon;
}
/**
* @ORM\Column(name="filter_saturday_evening", type="boolean", nullable=false)
*/
protected $filterSaturdayEvening;
public function getFilterSaturdayEvening(): bool
{
return $this->filterSaturdayEvening;
}
public function setFilterSaturdayEvening(bool $filterSaturdayEvening): void
{
$this->filterSaturdayEvening = $filterSaturdayEvening;
}
/**
* @ORM\Column(name="filter_saturday_night", type="boolean", nullable=false)
*/
protected $filterSaturdayNight;
public function getFilterSaturdayNight(): bool
{
return $this->filterSaturdayNight;
}
public function setFilterSaturdayNight(bool $filterSaturdayNight): void
{
$this->filterSaturdayNight = $filterSaturdayNight;
}
/**
* @ORM\Column(name="filter_sunday_morning", type="boolean", nullable=false)
*/
protected $filterSundayMorning;
public function getFilterSundayMorning(): bool
{
return $this->filterSundayMorning;
}
public function setFilterSundayMorning(bool $filterSundayMorning): void
{
$this->filterSundayMorning = $filterSundayMorning;
}
/**
* @ORM\Column(name="filter_sunday_noon", type="boolean", nullable=false)
*/
protected $filterSundayNoon;
public function getFilterSundayNoon(): bool
{
return $this->filterSundayNoon;
}
public function setFilterSundayNoon(bool $filterSundayNoon): void
{
$this->filterSundayNoon = $filterSundayNoon;
}
/**
* @ORM\Column(name="filter_sunday_evening", type="boolean", nullable=false)
*/
protected $filterSundayEvening;
public function getFilterSundayEvening(): bool
{
return $this->filterSundayEvening;
}
public function setFilterSundayEvening(bool $filterSundayEvening): void
{
$this->filterSundayEvening = $filterSundayEvening;
}
/**
* @ORM\Column(name="filter_sunday_night", type="boolean", nullable=false)
*/
protected $filterSundayNight;
public function getFilterSundayNight(): bool
{
return $this->filterSundayNight;
}
public function setFilterSundayNight(bool $filterSundayNight): void
{
$this->filterSundayNight = $filterSundayNight;
}
/**
* @ORM\Column(name="request_id", type="text", length=256, nullable=true)
*/
protected $requestId;
public function setRequestId(?string $requestId = null): void
{
$this->requestId = $requestId;
}
public function getRequestId(): ?string
{
return $this->requestId;
}
/**
* @ORM\Column(name="session_id", type="text", length=256, nullable=true)
*/
protected $sessionId;
public function setSessionId(?string $sessionId = null): void
{
$this->sessionId = $sessionId;
}
public function getSessionId(): ?string
{
return $this->sessionId;
}
/**
* @ORM\Column(name="client_id", type="text", length=64, nullable=true)
*/
protected $clientId;
public function setClientId(?string $clientId = null): void
{
$this->clientId = $clientId;
}
public function getClientId(): ?string
{
return $this->clientId;
}
/**
* @ORM\Column(name="is_probably_bot_request", type="boolean", nullable=true)
*/
private ?bool $isProbablyBotRequest;
public function getIsProbablyBotRequest(): ?bool
{
return $this->isProbablyBotRequest;
}
public function setIsProbablyBotRequest(?bool $isProbablyBotRequest): void
{
$this->isProbablyBotRequest = $isProbablyBotRequest;
}
}