<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="App\Repository\SearchJobPositionRepository")
*/
class SearchJobPosition implements \JsonSerializable {
const STATUS_COMPANY = "company";
const STATUS_CANDIDATE = "candidate";
const STATUSES = [
self::STATUS_COMPANY => "Company",
self::STATUS_CANDIDATE => "Candidate",
];
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
public $id;
/**
* @ORM\Column(type="datetime", options={"default": "CURRENT_TIMESTAMP"})
*/
public $createdAt;
/**
* @ORM\Column(type="integer", nullable=true)
*/
public $period;
/**
* @ORM\ManyToOne(targetEntity="User")
*/
private $user;
/**
* @ORM\Column(type="array")
*/
public $keywords;
/**
* @ORM\ManyToMany(targetEntity="App\Entity\City")
*/
public $city;
/**
* @ORM\ManyToMany(targetEntity="App\Entity\Department")
*/
public $department;
/**
* @ORM\ManyToMany(targetEntity="App\Entity\Industry")
*/
public $industry;
/**
* @ORM\ManyToMany(targetEntity="App\Entity\JobType")
*/
public $jobType;
/**
* @ORM\ManyToMany(targetEntity="App\Entity\JobSubType")
*/
public $jobSubType;
/**
* @ORM\ManyToMany(targetEntity="App\Entity\PositionLevel")
*/
public $positionLevel;
/**
* @ORM\Column(type="json", nullable=true, options={"jsonb": true})
*/
public $search;
/**
* @ORM\Column(type="json", nullable=true, options={"jsonb": true})
*/
public $searchRequest;
/**
* @ORM\Column(type="text", nullable=true)
*/
public $sentJobsIds;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
public $salary;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $email;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $hash;
/**
* @ORM\Column(type="integer", nullable=true)
*/
public $lguserId;
public function __construct()
{
$this->setCreatedAt(new \DateTime());
$this->keywords = [];
$this->city = new ArrayCollection();
$this->department = new ArrayCollection();
$this->industry = new ArrayCollection();
$this->jobType = new ArrayCollection();
$this->jobSubType = new ArrayCollection();
$this->positionLevel = new ArrayCollection();
}
/**
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* @return \DateTime
*/
public function getCreatedAt(): \DateTime {
return $this->createdAt;
}
/**
* @param \DateTime $createdAt
*
* @return self
*/
public function setCreatedAt(\DateTime $createdAt): self {
$this->createdAt = $createdAt;
return $this;
}
/**
* @return int
*/
public function getPeriod(): int
{
return $this->period;
}
/**
* @param int $period
*
* @return self
*/
public function setPeriod(int $period): self
{
$this->period = $period;
return $this;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): self
{
$this->user = $user;
return $this;
}
/**
* @return array|string[]
*/
public function getKeywords(): array
{
return $this->keywords;
}
public function setKeywords(array $keywords): self
{
$this->keywords = $keywords;
return $this;
}
/**
* @return Collection|City[]
*/
public function getCities(): Collection
{
return $this->city;
}
public function addCity(City $city): self
{
if (!$this->city->contains($city)) {
$this->city[] = $city;
}
return $this;
}
public function removeCity(City $city): self
{
if ($this->city->contains($city)) {
$this->city->removeElement($city);
}
return $this;
}
public function setCities(ArrayCollection $cities): self
{
$this->city = $cities;
return $this;
}
/**
* @return Collection|Department[]
*/
public function getDepartments(): Collection
{
return $this->department;
}
public function addDepartment(Department $department): self
{
if (!$this->department->contains($department)) {
$this->department[] = $department;
}
return $this;
}
public function removeDepartment(Department $department): self
{
if ($this->department->contains($department)) {
$this->department->removeElement($department);
}
return $this;
}
public function setDepartments(ArrayCollection $departments): self
{
$this->department = $departments;
return $this;
}
/**
* @return Collection|Industry[]
*/
public function getIndustries(): Collection
{
return $this->industry;
}
public function addIndustry(Industry $industry): self
{
if (!$this->industry->contains($industry)) {
$this->industry[] = $industry;
}
return $this;
}
public function removeIndustry(Industry $industry): self
{
if ($this->industry->contains($industry)) {
$this->industry->removeElement($industry);
}
return $this;
}
public function setIndustries(ArrayCollection $industries): self
{
$this->industry = $industries;
return $this;
}
/**
* @return Collection|JobType[]
*/
public function getJobTypes(): Collection
{
return $this->jobType;
}
public function addJobType(JobType $jobType): self
{
if (!$this->jobType->contains($jobType)) {
$this->jobType[] = $jobType;
}
return $this;
}
public function removeJobType(JobType $jobType): self
{
if ($this->jobType->contains($jobType)) {
$this->jobType->removeElement($jobType);
}
return $this;
}
public function setJobTypes(ArrayCollection $jobTypes): self
{
$this->jobType = $jobTypes;
return $this;
}
/**
* @return Collection|JobSubType[]
*/
public function getJobSubTypes(): Collection
{
return $this->jobSubType;
}
public function addJobSubType(JobSubType $jobSubType): self
{
if (!$this->jobSubType->contains($jobSubType)) {
$this->jobSubType[] = $jobSubType;
}
return $this;
}
public function removeJobSubType(JobSubType $jobSubType): self
{
if ($this->jobSubType->contains($jobSubType)) {
$this->jobSubType->removeElement($jobSubType);
}
return $this;
}
public function setJobSubTypes(ArrayCollection $jobSubTypes): self
{
$this->jobSubType = $jobSubTypes;
return $this;
}
/**
* @return Collection|PositionLevel[]
*/
public function getPositionLevels(): Collection
{
return $this->positionLevel;
}
public function addPositionLevel(PositionLevel $positionLevel): self
{
if (!$this->positionLevel->contains($positionLevel)) {
$this->positionLevel[] = $positionLevel;
}
return $this;
}
public function removePositionLevel(PositionLevel $positionLevel): self
{
if ($this->positionLevel->contains($positionLevel)) {
$this->positionLevel->removeElement($positionLevel);
}
return $this;
}
public function setPositionLevel(ArrayCollection $positionLevel): self
{
$this->positionLevel = $positionLevel;
return $this;
}
/**
* @return string|null
*/
public function getSearch(): ?string
{
return $this->search;
}
/**
* @param string $search
*
* @return self
*/
public function setSearch(string $search): self
{
$this->search = $search;
return $this;
}
/**
* @return string|null
*/
public function getSearchRequest(): ?string
{
return $this->searchRequest;
}
/**
* @param string $search
*
* @return self
*/
public function setSearchRequest(string $searchRequest): self
{
$this->searchRequest = $searchRequest;
return $this;
}
/**
* @return string|null
*/
public function getSentJobsIds(): ?string
{
return $this->sentJobsIds;
}
/**
* @param string $search
*
* @return self
*/
public function setSentJobsIds(string $sentJobsIds): self
{
$this->sentJobsIds = $sentJobsIds;
return $this;
}
public function getSalary(): ?bool
{
return $this->salary;
}
public function setSalary(?bool $salary): self
{
$this->salary = $salary;
return $this;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(?string $email): self
{
$this->email = $email;
return $this;
}
public function getHash(): ?string
{
return $this->hash;
}
public function setHash(string $hash): self
{
$this->hash = $hash;
return $this;
}
public function getLguserId(): ?int
{
return $this->lguserId;
}
public function setLguserId(int $lguserId): self
{
$this->lguserId = $lguserId;
return $this;
}
/**
* Specify data which should be serialized to JSON
*
* @link https://php.net/manual/en/jsonserializable.jsonserialize.php
* @return mixed data which can be serialized by <b>json_encode</b>,
* which is a value of any type other than a resource.
* @since 5.4.0
*/
public function jsonSerialize() {
return [
'id' => $this->getId(),
'createdAt' => $this->getCreatedAt(),
'period' => $this->getPeriod(),
'keywords' => $this->getKeywords(),
'departments' => $this->getDepartments()->getValues(),
'industries' => $this->getIndustries()->getValues(),
'city' => $this->getCities()->getValues(),
'jobTypes' => $this->getJobTypes()->getValues(),
'jobTypeByLocation' => $this->getJobSubTypes()->getValues(),
'positionLevels' => $this->getPositionLevels()->getValues(),
'search' => $this->getSearch(),
'searchRequest' => $this->getSearchRequest(),
'sentJobsIds' => $this->getSentJobsIds(),
'salary' => $this->getSalary(),
'email' => $this->getEmail()
];
}
}