<?php
namespace App\Entity;
use App\Repository\AppraisalCategoryRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Symfony\Component\Serializer\Annotation\Groups;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: AppraisalCategoryRepository::class)]
class AppraisalCategory
{
#[Groups(['LogService'])]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[Groups(['LogService', 'Appraisal'])]
#[ORM\Column(length: 255)]
private ?string $title = null;
#[Groups(['LogService'])]
#[ORM\Column(length: 64)]
private ?string $type = null;
#[Groups(['LogService'])]
#[ORM\ManyToOne]
private ?Department $department = null;
#[ORM\OneToMany(mappedBy: 'appraisalCategory', targetEntity: AppraisalForm::class, cascade: ['persist', 'remove'])]
private Collection $questionnaire;
#[ORM\Column(type: Types::SMALLINT, nullable: true, options: ['default' => 0])]
private ?int $customOrder = 0;
#[Groups(['LogService'])]
#[ORM\Column(type: 'boolean', options: ['default' => false])]
private ?bool $isHidden = false;
#[Groups(['LogService'])]
#[ORM\ManyToOne]
#[ORM\JoinColumn(nullable: false)]
private ?User $createdBy = null;
#[Groups(['LogService'])]
#[ORM\Column]
private ?\DateTimeImmutable $createdAt = null;
#[Groups(['LogService'])]
#[ORM\ManyToOne]
private ?User $updatedBy = null;
#[Groups(['LogService'])]
#[ORM\Column(nullable: true)]
private ?\DateTimeImmutable $updatedAt = null;
#[ORM\ManyToOne(inversedBy: 'appraisalCategories')]
#[ORM\JoinColumn(nullable: false)]
private ?Company $company = null;
public function __construct()
{
$this->questionnaire = 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 getType(): ?string
{
return $this->type;
}
public function setType(string $type): self
{
$this->type = $type;
return $this;
}
public function getDepartment(): ?Department
{
return $this->department;
}
public function setDepartment(?Department $department): self
{
$this->department = $department;
return $this;
}
/**
* @return Collection<int, AppraisalForm>
*/
public function getQuestionnaire(): Collection
{
return $this->questionnaire;
}
public function addQuestionnaire(AppraisalForm $questionnaire): self
{
if (!$this->questionnaire->contains($questionnaire)) {
$this->questionnaire->add($questionnaire);
$questionnaire->setAppraisalCategory($this);
}
return $this;
}
public function removeQuestionnaire(AppraisalForm $questionnaire): self
{
if ($this->questionnaire->removeElement($questionnaire)) {
// set the owning side to null (unless already changed)
if ($questionnaire->getAppraisalCategory() === $this) {
$questionnaire->setAppraisalCategory(null);
}
}
return $this;
}
public function getCustomOrder(): ?int
{
return $this->customOrder;
}
public function setCustomOrder(int $customOrder): self
{
$this->customOrder = $customOrder;
return $this;
}
public function getIsHidden(): ?bool
{
return $this->isHidden;
}
public function setIsHidden(bool $isHidden): self
{
$this->isHidden = $isHidden;
return $this;
}
public function getCreatedBy(): ?User
{
return $this->createdBy;
}
public function setCreatedBy(?User $createdBy): self
{
$this->createdBy = $createdBy;
return $this;
}
public function getCreatedAt(): ?\DateTimeImmutable
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeImmutable $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getUpdatedBy(): ?User
{
return $this->updatedBy;
}
public function setUpdatedBy(?User $updatedBy): self
{
$this->updatedBy = $updatedBy;
return $this;
}
public function getUpdatedAt(): ?\DateTimeImmutable
{
return $this->updatedAt;
}
public function setUpdatedAt(?\DateTimeImmutable $updatedAt): self
{
$this->updatedAt = $updatedAt;
return $this;
}
public function getCompany(): ?Company
{
return $this->company;
}
public function setCompany(?Company $company): self
{
$this->company = $company;
return $this;
}
}