<?php
namespace App\Entity;
use App\Repository\RecruitVacancyRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use DateTime;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Serializer\Annotation\MaxDepth;
#[ORM\Entity(repositoryClass: RecruitVacancyRepository::class)]
class RecruitVacancy
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
#[Groups(['Recruitment'])]
private ?int $id = null;
#[ORM\Column(length: 255)]
#[Groups(['Recruitment'])]
private ?string $title = null;
#[ORM\Column(length: 255)]
#[Groups(['Recruitment'])]
private ?string $workplaceType = null;
#[ORM\Column(length: 255)]
#[Groups(['Recruitment'])]
private ?string $employmentType = null;
#[ORM\Column(length: 255)]
#[Groups(['Recruitment'])]
private ?string $reasonForHiring = null;
#[ORM\Column(length: 255)]
#[Groups(['Recruitment'])]
private ?string $status = null;
#[ORM\Column(length: 255)]
#[Groups(['Recruitment'])]
private ?string $seniorityLevel = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
#[Groups(['Recruitment'])]
private ?DateTime $startDate = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
#[Groups(['Recruitment'])]
private ?DateTime $endDate = null;
#[ORM\Column]
#[Groups(['Recruitment'])]
private ?int $estimatedSalary = null;
#[ORM\Column(length: 2000, nullable: true)]
#[Groups(['Recruitment'])]
private ?string $comments = null;
#[ORM\Column(type: 'text', nullable: true)]
#[Groups(['Recruitment'])]
private ?string $scopeOfWork = null;
#[ORM\Column]
#[Groups(['Recruitment'])]
private ?bool $displayOnWebsite = null;
#[ORM\Column]
#[Groups(['Recruitment'])]
private ?int $estimatedMonthlyRevenue = null;
#[ORM\OneToMany(mappedBy: 'vacancyId', targetEntity: RecruitApplication::class, orphanRemoval: true)]
#[Groups(['Recruitment'])]
private Collection $applications;
#[ORM\OneToMany(mappedBy: 'vacancy', targetEntity: RecruitSkillVacancy::class, orphanRemoval: true, cascade: ['persist'])]
#[Groups(['Recruitment'])]
private Collection $recruitSkillVacancies;
#[ORM\OneToMany(mappedBy: 'vacancy', targetEntity: RecruitVacancyLanguage::class, orphanRemoval: true, cascade: ['persist'])]
#[Groups(['Recruitment'])]
private Collection $recruitVacancyLanguages;
#[ORM\Column(nullable: true)]
#[Groups(['Recruitment'])]
private ?\DateTimeImmutable $createdAt = null;
#[ORM\OneToMany(mappedBy: 'vacancy', targetEntity: RecruitVacancyHiringmanager::class, orphanRemoval: true, cascade: ['persist'])]
#[Groups(['Recruitment'])]
private Collection $recruitVacancyHiringmanagers;
#[ORM\OneToMany(mappedBy: 'vacancy', targetEntity: RecruitVacancyDepartment::class, orphanRemoval: true, cascade: ['persist'])]
#[Groups(['Recruitment'])]
private Collection $recruitVacancyDepartments;
#[ORM\OneToMany(mappedBy: 'vacancy', targetEntity: RecruitVacancyOffice::class, orphanRemoval: true, cascade: ['persist'])]
#[Groups(['Recruitment'])]
private Collection $recruitVacancyOffices;
#[ORM\OneToMany(mappedBy: 'vacancy', targetEntity: RecruitVacancyClient::class, orphanRemoval: true, cascade: ['persist'])]
#[Groups(['Recruitment'])]
private Collection $recruitVacancyClients;
#[ORM\OneToMany(mappedBy: 'vacancy', targetEntity: RecruitVacancyApprover::class, orphanRemoval: true, cascade: ['persist'])]
#[Groups(['Recruitment'])]
private Collection $recruitVacancyApprovers;
#[ORM\ManyToOne(inversedBy: 'recruitVacancies')]
private ?User $createdBy = null;
#[ORM\OneToMany(mappedBy: 'vacancy', targetEntity: RecruitTrackingLink::class, orphanRemoval: true, cascade: ['persist'])]
#[Groups(['Recruitment'])]
private Collection $recruitTrackingLinks;
#[ORM\OneToMany(mappedBy: 'vacancy', targetEntity: RecruitQuestionVacancy::class, orphanRemoval: true, cascade: ['persist'])]
private Collection $recruitQuestionVacancies;
#[ORM\Column(nullable: true)]
private ?int $headcountToManage = null;
#[ORM\ManyToOne(targetEntity: RecruitEvaluationTemplate::class, inversedBy: 'recruitVacancies')]
#[ORM\JoinColumn(nullable: true, onDelete: 'SET NULL')]
private ?RecruitEvaluationTemplate $evaluationTemplate = null;
#[ORM\OneToMany(mappedBy: 'vacancy', targetEntity: RecruitVacancyEvaluationSkill::class, orphanRemoval: true, cascade: ['persist'])]
private Collection $recruitVacancyEvaluationSkills;
#[ORM\OneToMany(mappedBy: 'vacancy', targetEntity: RecruitVacancyHistory::class, orphanRemoval: true, cascade: ['persist'])]
private Collection $histories;
#[ORM\Column(length: 255, nullable: true)]
private ?string $comment = null;
#[ORM\Column(nullable: true)]
private ?int $budgetForBoosting = null;
#[ORM\ManyToOne(inversedBy: 'hmRecruitVacancies')]
private ?RecruitEvaluationTemplate $hmEvaluationTemplate = null;
public function __construct()
{
$this->createdAt = new \DateTimeImmutable();
$this->applications = new ArrayCollection();
$this->recruitSkillVacancies = new ArrayCollection();
$this->recruitVacancyLanguages = new ArrayCollection();
$this->recruitVacancyHiringmanagers = new ArrayCollection();
$this->recruitVacancyDepartments = new ArrayCollection();
$this->recruitVacancyOffices = new ArrayCollection();
$this->recruitVacancyClients = new ArrayCollection();
$this->recruitVacancyApprovers = new ArrayCollection();
$this->recruitTrackingLinks = new ArrayCollection();
$this->recruitQuestionVacancies = new ArrayCollection();
$this->recruitVacancyEvaluationSkills = new ArrayCollection();
$this->histories = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(string $title): self
{
$this->title = $title;
return $this;
}
public function getWorkplaceType(): ?string
{
return $this->workplaceType;
}
public function setWorkplaceType(string $workplaceType): self
{
$this->workplaceType = $workplaceType;
return $this;
}
public function getEmploymentType(): ?string
{
return $this->employmentType;
}
public function setEmploymentType(string $employmentType): self
{
$this->employmentType = $employmentType;
return $this;
}
public function getReasonForHiring(): ?string
{
return $this->reasonForHiring;
}
public function setReasonForHiring(string $reasonForHiring): self
{
$this->reasonForHiring = $reasonForHiring;
return $this;
}
public function getStatus(): ?string
{
return $this->status;
}
public function setStatus(string $status): self
{
$this->status = $status;
return $this;
}
public function getSeniorityLevel(): ?string
{
return $this->seniorityLevel;
}
public function setSeniorityLevel(string $seniorityLevel): self
{
$this->seniorityLevel = $seniorityLevel;
return $this;
}
public function getStartDate(): ?\DateTimeInterface
{
return $this->startDate;
}
public function setStartDate(string $startDate): self
{
$this->startDate = new DateTime($startDate);
return $this;
}
public function getEndDate(): ?\DateTimeInterface
{
return $this->endDate;
}
public function setEndDate(string $endDate): self
{
$this->endDate = new DateTime($endDate);
return $this;
}
public function getEstimatedSalary(): ?int
{
return $this->estimatedSalary;
}
public function setEstimatedSalary(int $estimatedSalary): self
{
$this->estimatedSalary = $estimatedSalary;
return $this;
}
public function getComments(): ?string
{
return $this->comments;
}
public function setComments(?string $comments): self
{
$this->comments = $comments;
return $this;
}
public function getScopeOfWork(): ?string
{
return $this->scopeOfWork;
}
public function setScopeOfWork(?string $scopeOfWork): self
{
$this->scopeOfWork = $scopeOfWork;
return $this;
}
public function isDisplayOnWebsite(): ?bool
{
return $this->displayOnWebsite;
}
public function setDisplayOnWebsite(bool $displayOnWebsite): self
{
$this->displayOnWebsite = $displayOnWebsite;
return $this;
}
public function getEstimatedMonthlyRevenue(): ?int
{
return $this->estimatedMonthlyRevenue;
}
public function setEstimatedMonthlyRevenue(int $estimatedMonthlyRevenue): self
{
$this->estimatedMonthlyRevenue = $estimatedMonthlyRevenue;
return $this;
}
/**
* @return Collection<int, RecruitApplication>
*/
public function getApplications(): Collection
{
return $this->applications;
}
public function addApplication(RecruitApplication $application): self
{
if (!$this->applications->contains($application)) {
$this->applications->add($application);
$application->setVacancyId($this);
}
return $this;
}
public function removeApplication(RecruitApplication $application): self
{
if ($this->applications->removeElement($application)) {
// set the owning side to null (unless already changed)
if ($application->getVacancyId() === $this) {
$application->setVacancyId(null);
}
}
return $this;
}
/**
* @return Collection<int, RecruitSkillVacancy>
*/
public function getRecruitSkillVacancies(): Collection
{
return $this->recruitSkillVacancies;
}
public function addRecruitSkillVacancy(RecruitSkillVacancy $recruitSkillVacancy): self
{
if (!$this->recruitSkillVacancies->contains($recruitSkillVacancy)) {
$this->recruitSkillVacancies->add($recruitSkillVacancy);
$recruitSkillVacancy->setVacancy($this);
}
return $this;
}
public function removeRecruitSkillVacancy(RecruitSkillVacancy $recruitSkillVacancy): self
{
if ($this->recruitSkillVacancies->removeElement($recruitSkillVacancy)) {
// set the owning side to null (unless already changed)
if ($recruitSkillVacancy->getVacancy() === $this) {
$recruitSkillVacancy->setVacancy(null);
}
}
return $this;
}
/**
* @return Collection<int, RecruitVacancyLanguage>
*/
public function getRecruitVacancyLanguages(): Collection
{
return $this->recruitVacancyLanguages;
}
public function addRecruitVacancyLanguage(RecruitVacancyLanguage $recruitVacancyLanguage): self
{
if (!$this->recruitVacancyLanguages->contains($recruitVacancyLanguage)) {
$this->recruitVacancyLanguages->add($recruitVacancyLanguage);
$recruitVacancyLanguage->setVacancy($this);
}
return $this;
}
public function removeRecruitVacancyLanguage(RecruitVacancyLanguage $recruitVacancyLanguage): self
{
if ($this->recruitVacancyLanguages->removeElement($recruitVacancyLanguage)) {
// set the owning side to null (unless already changed)
if ($recruitVacancyLanguage->getVacancy() === $this) {
$recruitVacancyLanguage->setVacancy(null);
}
}
return $this;
}
public function getCreatedAt(): ?\DateTimeImmutable
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeImmutable $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
/**
* @return Collection<int, RecruitVacancyHiringmanager>
*/
public function getRecruitVacancyHiringmanagers(): Collection
{
return $this->recruitVacancyHiringmanagers;
}
public function addRecruitVacancyHiringmanager(RecruitVacancyHiringmanager $recruitVacancyHiringmanager): self
{
if (!$this->recruitVacancyHiringmanagers->contains($recruitVacancyHiringmanager)) {
$this->recruitVacancyHiringmanagers->add($recruitVacancyHiringmanager);
$recruitVacancyHiringmanager->setVacancy($this);
}
return $this;
}
public function removeRecruitVacancyHiringmanager(RecruitVacancyHiringmanager $recruitVacancyHiringmanager): self
{
if ($this->recruitVacancyHiringmanagers->removeElement($recruitVacancyHiringmanager)) {
// set the owning side to null (unless already changed)
if ($recruitVacancyHiringmanager->getVacancy() === $this) {
$recruitVacancyHiringmanager->setVacancy(null);
}
}
return $this;
}
public function removeAllRecruitVacancyHiringmanager(): self
{
$this->recruitVacancyHiringmanagers = new ArrayCollection();
return $this;
}
/**
* @return Collection<int, RecruitVacancyDepartment>
*/
public function getRecruitVacancyDepartments(): Collection
{
return $this->recruitVacancyDepartments;
}
public function addRecruitVacancyDepartment(RecruitVacancyDepartment $recruitVacancyDepartment): self
{
if (!$this->recruitVacancyDepartments->contains($recruitVacancyDepartment)) {
$this->recruitVacancyDepartments->add($recruitVacancyDepartment);
$recruitVacancyDepartment->setVacancy($this);
}
return $this;
}
public function removeRecruitVacancyDepartment(RecruitVacancyDepartment $recruitVacancyDepartment): self
{
if ($this->recruitVacancyDepartments->removeElement($recruitVacancyDepartment)) {
// set the owning side to null (unless already changed)
if ($recruitVacancyDepartment->getVacancy() === $this) {
$recruitVacancyDepartment->setVacancy(null);
}
}
return $this;
}
/**
* @return Collection<int, RecruitVacancyOffice>
*/
public function getRecruitVacancyOffices(): Collection
{
return $this->recruitVacancyOffices;
}
public function addRecruitVacancyOffice(RecruitVacancyOffice $recruitVacancyOffice): self
{
if (!$this->recruitVacancyOffices->contains($recruitVacancyOffice)) {
$this->recruitVacancyOffices->add($recruitVacancyOffice);
$recruitVacancyOffice->setVacancy($this);
}
return $this;
}
public function removeRecruitVacancyOffice(RecruitVacancyOffice $recruitVacancyOffice): self
{
if ($this->recruitVacancyOffices->removeElement($recruitVacancyOffice)) {
// set the owning side to null (unless already changed)
if ($recruitVacancyOffice->getVacancy() === $this) {
$recruitVacancyOffice->setVacancy(null);
}
}
return $this;
}
/**
* @return Collection<int, RecruitVacancyClient>
*/
public function getRecruitVacancyClients(): Collection
{
return $this->recruitVacancyClients;
}
public function addRecruitVacancyClient(RecruitVacancyClient $recruitVacancyClient): self
{
if (!$this->recruitVacancyClients->contains($recruitVacancyClient)) {
$this->recruitVacancyClients->add($recruitVacancyClient);
$recruitVacancyClient->setVacancy($this);
}
return $this;
}
public function removeRecruitVacancyClient(RecruitVacancyClient $recruitVacancyClient): self
{
if ($this->recruitVacancyClients->removeElement($recruitVacancyClient)) {
// set the owning side to null (unless already changed)
if ($recruitVacancyClient->getVacancy() === $this) {
$recruitVacancyClient->setVacancy(null);
}
}
return $this;
}
/**
* @return Collection<int, RecruitVacancyApprover>
*/
public function getRecruitVacancyApprovers(): Collection
{
return $this->recruitVacancyApprovers;
}
public function addRecruitVacancyApprover(RecruitVacancyApprover $recruitVacancyApprover): self
{
if (!$this->recruitVacancyApprovers->contains($recruitVacancyApprover)) {
$this->recruitVacancyApprovers->add($recruitVacancyApprover);
$recruitVacancyApprover->setVacancy($this);
}
return $this;
}
public function removeRecruitVacancyApprover(RecruitVacancyApprover $recruitVacancyApprover): self
{
if ($this->recruitVacancyApprovers->removeElement($recruitVacancyApprover)) {
// set the owning side to null (unless already changed)
if ($recruitVacancyApprover->getVacancy() === $this) {
$recruitVacancyApprover->setVacancy(null);
}
}
return $this;
}
public function getCreatedBy(): ?User
{
return $this->createdBy;
}
public function setCreatedBy(?User $createdBy): self
{
$this->createdBy = $createdBy;
return $this;
}
public function duplicateWithRelations()
{
$newVacancy = clone $this;
// Reset collections for the new vacancy
$newVacancy->createdAt = new \DateTimeImmutable();
$newVacancy->applications = new ArrayCollection();
$newVacancy->recruitSkillVacancies = new ArrayCollection();
$newVacancy->recruitVacancyLanguages = new ArrayCollection();
$newVacancy->recruitVacancyHiringmanagers = new ArrayCollection();
$newVacancy->recruitVacancyDepartments = new ArrayCollection();
$newVacancy->recruitVacancyOffices = new ArrayCollection();
$newVacancy->recruitVacancyClients = new ArrayCollection();
$newVacancy->recruitVacancyApprovers = new ArrayCollection();
// Duplicate and add related skill vacancies
foreach ($this->recruitSkillVacancies as $skillVacancy) {
$newSkillVacancy = clone $skillVacancy;
$newVacancy->addRecruitSkillVacancy($newSkillVacancy);
}
// Duplicate and add related languages
foreach ($this->recruitVacancyLanguages as $language) {
$newLanguage = clone $language;
$newVacancy->addRecruitVacancyLanguage($newLanguage);
}
// Duplicate and add related hiring managers
foreach ($this->recruitVacancyHiringmanagers as $hiringManager) {
$newHiringManager = clone $hiringManager;
$newVacancy->addRecruitVacancyHiringmanager($newHiringManager);
}
// Duplicate and add related departments
foreach ($this->recruitVacancyDepartments as $department) {
$newDepartment = clone $department;
$newVacancy->addRecruitVacancyDepartment($newDepartment);
}
// Duplicate and add related offices
foreach ($this->recruitVacancyOffices as $office) {
$newOffice = clone $office;
$newVacancy->addRecruitVacancyOffice($newOffice);
}
// Duplicate and add related clients
foreach ($this->recruitVacancyClients as $client) {
$newClient = clone $client;
$newVacancy->addRecruitVacancyClient($newClient);
}
// Duplicate and add related approvers
foreach ($this->recruitVacancyApprovers as $approver) {
$newApprover = clone $approver;
$newVacancy->addRecruitVacancyApprover($newApprover);
}
return $newVacancy;
}
/**
* @return Collection<int, RecruitTrackingLink>
*/
public function getRecruitTrackingLinks(): Collection
{
return $this->recruitTrackingLinks;
}
public function addRecruitTrackingLink(RecruitTrackingLink $recruitTrackingLink): self
{
if (!$this->recruitTrackingLinks->contains($recruitTrackingLink)) {
$this->recruitTrackingLinks->add($recruitTrackingLink);
$recruitTrackingLink->setVacancy($this);
}
return $this;
}
public function removeRecruitTrackingLink(RecruitTrackingLink $recruitTrackingLink): self
{
if ($this->recruitTrackingLinks->removeElement($recruitTrackingLink)) {
// set the owning side to null (unless already changed)
if ($recruitTrackingLink->getVacancy() === $this) {
$recruitTrackingLink->setVacancy(null);
}
}
return $this;
}
/**
* @return Collection<int, RecruitQuestionVacancy>
*/
public function getRecruitQuestionVacancies(): Collection
{
return $this->recruitQuestionVacancies;
}
public function addRecruitQuestionVacancy(RecruitQuestionVacancy $recruitQuestionVacancy): self
{
if (!$this->recruitQuestionVacancies->contains($recruitQuestionVacancy)) {
$this->recruitQuestionVacancies->add($recruitQuestionVacancy);
$recruitQuestionVacancy->setVacancy($this);
}
return $this;
}
public function removeRecruitQuestionVacancy(RecruitQuestionVacancy $recruitQuestionVacancy): self
{
if ($this->recruitQuestionVacancies->removeElement($recruitQuestionVacancy)) {
// set the owning side to null (unless already changed)
if ($recruitQuestionVacancy->getVacancy() === $this) {
$recruitQuestionVacancy->setVacancy(null);
}
}
return $this;
}
public function getHeadcountToManage(): ?int
{
return $this->headcountToManage;
}
public function setHeadcountToManage(?int $headcountToManage): self
{
$this->headcountToManage = $headcountToManage;
return $this;
}
public function getEvaluationTemplate(): ?RecruitEvaluationTemplate
{
return $this->evaluationTemplate;
}
public function setEvaluationTemplate(?RecruitEvaluationTemplate $evaluationTemplate): self
{
$this->evaluationTemplate = $evaluationTemplate;
return $this;
}
/**
* @return Collection<int, RecruitVacancyEvaluationSkill>
*/
public function getRecruitVacancyEvaluationSkills(): Collection
{
return $this->recruitVacancyEvaluationSkills;
}
public function addRecruitVacancyEvaluationSkill(RecruitVacancyEvaluationSkill $recruitVacancyEvaluationSkill): self
{
if (!$this->recruitVacancyEvaluationSkills->contains($recruitVacancyEvaluationSkill)) {
$this->recruitVacancyEvaluationSkills->add($recruitVacancyEvaluationSkill);
$recruitVacancyEvaluationSkill->setVacancy($this);
}
return $this;
}
public function removeRecruitVacancyEvaluationSkill(RecruitVacancyEvaluationSkill $recruitVacancyEvaluationSkill): self
{
if ($this->recruitVacancyEvaluationSkills->removeElement($recruitVacancyEvaluationSkill)) {
// set the owning side to null (unless already changed)
if ($recruitVacancyEvaluationSkill->getVacancy() === $this) {
$recruitVacancyEvaluationSkill->setVacancy(null);
}
}
return $this;
}
/**
* @return Collection<int, RecruitVacancyHistory>
*/
public function getHistories(): Collection
{
return $this->histories;
}
public function addHistory(RecruitVacancyHistory $history): self
{
if (!$this->histories->contains($history)) {
$this->histories->add($history);
$history->setVacancy($this);
}
return $this;
}
public function removeHistory(RecruitVacancyHistory $history): self
{
if ($this->histories->removeElement($history)) {
// set the owning side to null (unless already changed)
if ($history->getVacancy() === $this) {
$history->setVacancy(null);
}
}
return $this;
}
public function getComment(): ?string
{
return $this->comment;
}
public function setComment(?string $comment): self
{
$this->comment = $comment;
return $this;
}
public function getBudgetForBoosting(): ?int
{
return $this->budgetForBoosting;
}
public function setBudgetForBoosting(?int $budgetForBoosting): self
{
$this->budgetForBoosting = $budgetForBoosting;
return $this;
}
public function getHmEvaluationTemplate(): ?RecruitEvaluationTemplate
{
return $this->hmEvaluationTemplate;
}
public function setHmEvaluationTemplate(?RecruitEvaluationTemplate $hmEvaluationTemplate): self
{
$this->hmEvaluationTemplate = $hmEvaluationTemplate;
return $this;
}
}