src/Entity/SearchJobPosition.php line 513

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. /**
  7.  * @ORM\Entity(repositoryClass="App\Repository\SearchJobPositionRepository")
  8.  */
  9. class SearchJobPosition implements \JsonSerializable {
  10.     const STATUS_COMPANY = "company";
  11.     const STATUS_CANDIDATE = "candidate";
  12.     const STATUSES = [
  13.         self::STATUS_COMPANY => "Company",
  14.         self::STATUS_CANDIDATE => "Candidate",
  15.     ];
  16.     /**
  17.      * @ORM\Id()
  18.      * @ORM\GeneratedValue()
  19.      * @ORM\Column(type="integer")
  20.      */
  21.     public $id;
  22.     /**
  23.      * @ORM\Column(type="datetime", options={"default": "CURRENT_TIMESTAMP"})
  24.      */
  25.     public $createdAt;
  26.     /**
  27.      * @ORM\Column(type="integer", nullable=true)
  28.      */
  29.     public $period;
  30.     /**
  31.      * @ORM\ManyToOne(targetEntity="User")
  32.      */
  33.     private $user;
  34.     /**
  35.      * @ORM\Column(type="array")
  36.      */
  37.     public $keywords;
  38.     /**
  39.      * @ORM\ManyToMany(targetEntity="App\Entity\City")
  40.      */
  41.     public $city;
  42.     /**
  43.      * @ORM\ManyToMany(targetEntity="App\Entity\Department")
  44.      */
  45.     public $department;
  46.     
  47.     /**
  48.      * @ORM\ManyToMany(targetEntity="App\Entity\Industry")
  49.      */
  50.     public $industry;
  51.     
  52.     /**
  53.      * @ORM\ManyToMany(targetEntity="App\Entity\JobType")
  54.      */
  55.     public $jobType;
  56.     /**
  57.      * @ORM\ManyToMany(targetEntity="App\Entity\JobSubType")
  58.      */
  59.     public $jobSubType;
  60.     /**
  61.      * @ORM\ManyToMany(targetEntity="App\Entity\PositionLevel")
  62.      */
  63.     public $positionLevel;
  64.     /**
  65.      * @ORM\Column(type="json", nullable=true, options={"jsonb": true})
  66.      */
  67.     public $search;
  68.     /**
  69.      * @ORM\Column(type="json", nullable=true, options={"jsonb": true})
  70.      */
  71.     public $searchRequest;
  72.     /**
  73.      * @ORM\Column(type="text", nullable=true)
  74.      */
  75.     public $sentJobsIds;
  76.     /**
  77.      * @ORM\Column(type="boolean", nullable=true)
  78.      */
  79.     public $salary;
  80.     /**
  81.      * @ORM\Column(type="string", length=255, nullable=true)
  82.      */
  83.     private $email;
  84.     /**
  85.      * @ORM\Column(type="string", nullable=true)
  86.      */
  87.     private $hash;
  88.     /**
  89.      * @ORM\Column(type="integer", nullable=true)
  90.      */
  91.     public $lguserId;
  92.     public function __construct()
  93.     {
  94.         $this->setCreatedAt(new \DateTime());
  95.         $this->keywords = [];
  96.         $this->city = new ArrayCollection();
  97.         $this->department = new ArrayCollection();
  98.         $this->industry = new ArrayCollection();
  99.         $this->jobType = new ArrayCollection();
  100.         $this->jobSubType = new ArrayCollection();
  101.         $this->positionLevel = new ArrayCollection();
  102.     }
  103.     /**
  104.      * @return int
  105.      */
  106.     public function getId()
  107.     {
  108.         return $this->id;
  109.     }
  110.     /**
  111.      * @return \DateTime
  112.      */
  113.     public function getCreatedAt(): \DateTime {
  114.         return $this->createdAt;
  115.     }
  116.     /**
  117.      * @param \DateTime $createdAt
  118.      *
  119.      * @return self
  120.      */
  121.     public function setCreatedAt(\DateTime $createdAt): self {
  122.         $this->createdAt = $createdAt;
  123.         return $this;
  124.     }
  125.     /**
  126.      * @return int
  127.      */
  128.     public function getPeriod(): int
  129.     {
  130.         return $this->period;
  131.     }
  132.     /**
  133.      * @param int $period
  134.      *
  135.      * @return self
  136.      */
  137.     public function setPeriod(int $period): self
  138.     {
  139.         $this->period = $period;
  140.         return $this;
  141.     }
  142.     public function getUser(): ?User
  143.     {
  144.         return $this->user;
  145.     }
  146.     public function setUser(?User $user): self
  147.     {
  148.         $this->user = $user;
  149.         return $this;
  150.     }
  151.     /**
  152.      * @return array|string[]
  153.      */
  154.     public function getKeywords(): array
  155.     {
  156.         return $this->keywords;
  157.     }
  158.     public function setKeywords(array $keywords): self
  159.     {
  160.         $this->keywords = $keywords;
  161.         return $this;
  162.     }
  163.     /**
  164.      * @return Collection|City[]
  165.      */
  166.     public function getCities(): Collection
  167.     {
  168.         return $this->city;
  169.     }
  170.     public function addCity(City $city): self
  171.     {
  172.         if (!$this->city->contains($city)) {
  173.             $this->city[] = $city;
  174.         }
  175.         return $this;
  176.     }
  177.     public function removeCity(City $city): self
  178.     {
  179.         if ($this->city->contains($city)) {
  180.             $this->city->removeElement($city);
  181.         }
  182.         return $this;
  183.     }
  184.     public function setCities(ArrayCollection $cities): self
  185.     {
  186.         $this->city = $cities;
  187.         return $this;
  188.     }
  189.     
  190.     /**
  191.      * @return Collection|Department[]
  192.      */
  193.     public function getDepartments(): Collection
  194.     {
  195.         return $this->department;
  196.     }
  197.     public function addDepartment(Department $department): self
  198.     {
  199.         if (!$this->department->contains($department)) {
  200.             $this->department[] = $department;
  201.         }
  202.         return $this;
  203.     }
  204.     public function removeDepartment(Department $department): self
  205.     {
  206.         if ($this->department->contains($department)) {
  207.             $this->department->removeElement($department);
  208.         }
  209.         return $this;
  210.     }
  211.     public function setDepartments(ArrayCollection $departments): self
  212.     {
  213.         $this->department = $departments;
  214.         return $this;
  215.     }
  216.     /**
  217.      * @return Collection|Industry[]
  218.      */
  219.     public function getIndustries(): Collection
  220.     {
  221.         return $this->industry;
  222.     }
  223.     public function addIndustry(Industry $industry): self
  224.     {
  225.         if (!$this->industry->contains($industry)) {
  226.             $this->industry[] = $industry;
  227.         }
  228.         return $this;
  229.     }
  230.     public function removeIndustry(Industry $industry): self
  231.     {
  232.         if ($this->industry->contains($industry)) {
  233.             $this->industry->removeElement($industry);
  234.         }
  235.         return $this;
  236.     }
  237.     public function setIndustries(ArrayCollection $industries): self
  238.     {
  239.         $this->industry = $industries;
  240.         return $this;
  241.     }
  242.     /**
  243.      * @return Collection|JobType[]
  244.      */
  245.     public function getJobTypes(): Collection
  246.     {
  247.         return $this->jobType;
  248.     }
  249.     public function addJobType(JobType $jobType): self
  250.     {
  251.         if (!$this->jobType->contains($jobType)) {
  252.             $this->jobType[] = $jobType;
  253.         }
  254.         return $this;
  255.     }
  256.     public function removeJobType(JobType $jobType): self
  257.     {
  258.         if ($this->jobType->contains($jobType)) {
  259.             $this->jobType->removeElement($jobType);
  260.         }
  261.         return $this;
  262.     }
  263.     public function setJobTypes(ArrayCollection $jobTypes): self
  264.     {
  265.         $this->jobType = $jobTypes;
  266.         return $this;
  267.     }
  268.     /**
  269.      * @return Collection|JobSubType[]
  270.      */
  271.     public function getJobSubTypes(): Collection
  272.     {
  273.         return $this->jobSubType;
  274.     }
  275.     public function addJobSubType(JobSubType $jobSubType): self
  276.     {
  277.         if (!$this->jobSubType->contains($jobSubType)) {
  278.             $this->jobSubType[] = $jobSubType;
  279.         }
  280.         return $this;
  281.     }
  282.     public function removeJobSubType(JobSubType $jobSubType): self
  283.     {
  284.         if ($this->jobSubType->contains($jobSubType)) {
  285.             $this->jobSubType->removeElement($jobSubType);
  286.         }
  287.         return $this;
  288.     }
  289.     public function setJobSubTypes(ArrayCollection $jobSubTypes): self
  290.     {
  291.         $this->jobSubType = $jobSubTypes;
  292.         return $this;
  293.     }
  294.     /**
  295.      * @return Collection|PositionLevel[]
  296.      */
  297.     public function getPositionLevels(): Collection
  298.     {
  299.         return $this->positionLevel;
  300.     }
  301.     public function addPositionLevel(PositionLevel $positionLevel): self
  302.     {
  303.         if (!$this->positionLevel->contains($positionLevel)) {
  304.             $this->positionLevel[] = $positionLevel;
  305.         }
  306.         return $this;
  307.     }
  308.     public function removePositionLevel(PositionLevel $positionLevel): self
  309.     {
  310.         if ($this->positionLevel->contains($positionLevel)) {
  311.             $this->positionLevel->removeElement($positionLevel);
  312.         }
  313.         return $this;
  314.     }
  315.     public function setPositionLevel(ArrayCollection $positionLevel): self
  316.     {
  317.         $this->positionLevel = $positionLevel;
  318.         return $this;
  319.     }
  320.     /**
  321.      * @return string|null
  322.      */
  323.     public function getSearch(): ?string
  324.     {
  325.         return $this->search;
  326.     }
  327.     /**
  328.      * @param string $search
  329.      *
  330.      * @return self
  331.      */
  332.     public function setSearch(string $search): self
  333.     {
  334.         $this->search = $search;
  335.         return $this;
  336.     }
  337.     /**
  338.      * @return string|null
  339.      */
  340.     public function getSearchRequest(): ?string
  341.     {
  342.         return $this->searchRequest;
  343.     }
  344.     /**
  345.      * @param string $search
  346.      *
  347.      * @return self
  348.      */
  349.     public function setSearchRequest(string $searchRequest): self
  350.     {
  351.         $this->searchRequest = $searchRequest;
  352.         return $this;
  353.     }
  354.     /**
  355.      * @return string|null
  356.      */
  357.     public function getSentJobsIds(): ?string
  358.     {
  359.         return $this->sentJobsIds;
  360.     }
  361.     /**
  362.      * @param string $search
  363.      *
  364.      * @return self
  365.      */
  366.     public function setSentJobsIds(string $sentJobsIds): self
  367.     {
  368.         $this->sentJobsIds = $sentJobsIds;
  369.         return $this;
  370.     }
  371.     public function getSalary(): ?bool
  372.     {
  373.         return $this->salary;
  374.     }
  375.     public function setSalary(?bool $salary): self
  376.     {
  377.         $this->salary = $salary;
  378.         return $this;
  379.     }
  380.     public function getEmail(): ?string
  381.     {
  382.         return $this->email;
  383.     }
  384.     public function setEmail(?string $email): self
  385.     {
  386.         $this->email = $email;
  387.         return $this;
  388.     }
  389.     public function getHash(): ?string
  390.     {
  391.         return $this->hash;
  392.     }
  393.     public function setHash(string $hash): self
  394.     {
  395.         $this->hash = $hash;
  396.         return $this;
  397.     }
  398.    
  399.     public function getLguserId(): ?int
  400.     {
  401.         return $this->lguserId;
  402.     }
  403.     
  404.     public function setLguserId(int $lguserId): self
  405.     {
  406.         $this->lguserId = $lguserId;
  407.         return $this;
  408.     }
  409.     /**
  410.      * Specify data which should be serialized to JSON
  411.      *
  412.      * @link https://php.net/manual/en/jsonserializable.jsonserialize.php
  413.      * @return mixed data which can be serialized by <b>json_encode</b>,
  414.      * which is a value of any type other than a resource.
  415.      * @since 5.4.0
  416.      */
  417.     public function jsonSerialize() {
  418.         return [
  419.             'id' => $this->getId(),
  420.             'createdAt' => $this->getCreatedAt(),
  421.             'period' => $this->getPeriod(),
  422.             'keywords' => $this->getKeywords(),
  423.             'departments' => $this->getDepartments()->getValues(),
  424.             'industries' => $this->getIndustries()->getValues(),
  425.             'city' => $this->getCities()->getValues(),
  426.             'jobTypes' => $this->getJobTypes()->getValues(),
  427.             'jobTypeByLocation' => $this->getJobSubTypes()->getValues(),
  428.             'positionLevels' => $this->getPositionLevels()->getValues(),
  429.             'search' => $this->getSearch(),
  430.             'searchRequest' => $this->getSearchRequest(),
  431.             'sentJobsIds' => $this->getSentJobsIds(),
  432.             'salary' => $this->getSalary(),
  433.             'email' => $this->getEmail()
  434.         ];
  435.     }
  436. }