<?php
namespace App\Entity;
use App\Repository\RecruitQuestionRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: RecruitQuestionRepository::class)]
class RecruitQuestion
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(type: Types::TEXT)]
private ?string $question = null;
#[ORM\Column]
private ?bool $mandatory = null;
#[ORM\Column(length: 20)]
private ?string $type = null;
#[ORM\Column]
private ?\DateTimeImmutable $createdAt = null;
#[ORM\ManyToOne(inversedBy: 'recruitQuestions')]
#[ORM\JoinColumn(nullable: false)]
private ?User $createdBy = null;
#[ORM\Column(nullable: true)]
private ?\DateTimeImmutable $updatedAt = null;
#[ORM\ManyToOne]
private ?User $updatedBy = null;
#[ORM\OneToMany(mappedBy: 'question', targetEntity: RecruitQuestionOption::class, orphanRemoval: true)]
private Collection $recruitQuestionOptions;
#[ORM\OneToMany(mappedBy: 'question', targetEntity: RecruitQuestionOffice::class, orphanRemoval: true)]
private Collection $recruitQuestionOffices;
#[ORM\OneToMany(mappedBy: 'question', targetEntity: RecruitQuestionDepartment::class, orphanRemoval: true)]
private Collection $recruitQuestionDepartments;
#[ORM\OneToMany(mappedBy: 'questionTemplate', targetEntity: RecruitQuestionVacancy::class)]
private Collection $recruitQuestionVacancies;
public function __construct()
{
$this->recruitQuestionOptions = new ArrayCollection();
$this->recruitQuestionOffices = new ArrayCollection();
$this->recruitQuestionDepartments = new ArrayCollection();
$this->recruitQuestionVacancies = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getQuestion(): ?string
{
return $this->question;
}
public function setQuestion(string $question): self
{
$this->question = $question;
return $this;
}
public function isMandatory(): ?bool
{
return $this->mandatory;
}
public function setMandatory(bool $mandatory): self
{
$this->mandatory = $mandatory;
return $this;
}
public function getType(): ?string
{
return $this->type;
}
public function setType(string $type): self
{
$this->type = $type;
return $this;
}
public function getCreatedAt(): ?\DateTimeImmutable
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeImmutable $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getCreatedBy(): ?User
{
return $this->createdBy;
}
public function setCreatedBy(?User $createdBy): self
{
$this->createdBy = $createdBy;
return $this;
}
public function getUpdatedAt(): ?\DateTimeImmutable
{
return $this->updatedAt;
}
public function setUpdatedAt(?\DateTimeImmutable $updatedAt): self
{
$this->updatedAt = $updatedAt;
return $this;
}
public function getUpdatedBy(): ?User
{
return $this->updatedBy;
}
public function setUpdatedBy(?User $updatedBy): self
{
$this->updatedBy = $updatedBy;
return $this;
}
/**
* @return Collection<int, RecruitQuestionOption>
*/
public function getRecruitQuestionOptions(): Collection
{
return $this->recruitQuestionOptions;
}
public function addRecruitQuestionOption(RecruitQuestionOption $recruitQuestionOption): self
{
if (!$this->recruitQuestionOptions->contains($recruitQuestionOption)) {
$this->recruitQuestionOptions->add($recruitQuestionOption);
$recruitQuestionOption->setQuestion($this);
}
return $this;
}
public function removeRecruitQuestionOption(RecruitQuestionOption $recruitQuestionOption): self
{
if ($this->recruitQuestionOptions->removeElement($recruitQuestionOption)) {
// set the owning side to null (unless already changed)
if ($recruitQuestionOption->getQuestion() === $this) {
$recruitQuestionOption->setQuestion(null);
}
}
return $this;
}
/**
* @return Collection<int, RecruitQuestionOffice>
*/
public function getRecruitQuestionOffices(): Collection
{
return $this->recruitQuestionOffices;
}
public function addRecruitQuestionOffice(RecruitQuestionOffice $recruitQuestionOffice): self
{
if (!$this->recruitQuestionOffices->contains($recruitQuestionOffice)) {
$this->recruitQuestionOffices->add($recruitQuestionOffice);
$recruitQuestionOffice->setQuestion($this);
}
return $this;
}
public function removeRecruitQuestionOffice(RecruitQuestionOffice $recruitQuestionOffice): self
{
if ($this->recruitQuestionOffices->removeElement($recruitQuestionOffice)) {
// set the owning side to null (unless already changed)
if ($recruitQuestionOffice->getQuestion() === $this) {
$recruitQuestionOffice->setQuestion(null);
}
}
return $this;
}
/**
* @return Collection<int, RecruitQuestionDepartment>
*/
public function getRecruitQuestionDepartments(): Collection
{
return $this->recruitQuestionDepartments;
}
public function addRecruitQuestionDepartment(RecruitQuestionDepartment $recruitQuestionDepartment): self
{
if (!$this->recruitQuestionDepartments->contains($recruitQuestionDepartment)) {
$this->recruitQuestionDepartments->add($recruitQuestionDepartment);
$recruitQuestionDepartment->setQuestion($this);
}
return $this;
}
public function removeRecruitQuestionDepartment(RecruitQuestionDepartment $recruitQuestionDepartment): self
{
if ($this->recruitQuestionDepartments->removeElement($recruitQuestionDepartment)) {
// set the owning side to null (unless already changed)
if ($recruitQuestionDepartment->getQuestion() === $this) {
$recruitQuestionDepartment->setQuestion(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->setQuestionTemplate($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->getQuestionTemplate() === $this) {
$recruitQuestionVacancy->setQuestionTemplate(null);
}
}
return $this;
}
}