<?php
namespace App\Entity;
use App\Repository\LeaveTypeRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: LeaveTypeRepository::class)]
class LeaveType
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'string', length: 128)]
private $leaveName;
#[ORM\Column(type: 'boolean', nullable: true)]
private $isActive;
#[ORM\Column(type: 'boolean', nullable: false)]
private $isMandatory = false;
#[ORM\Column(type: 'decimal', precision: 4, scale: 1, nullable: true)]
private $days;
#[ORM\ManyToOne(targetEntity: Office::class, inversedBy: 'leaveTypes')]
private $office;
#[ORM\Column(type: 'json', nullable: true)]
private $attributes = [];
#[ORM\Column(type: 'datetime', nullable: true)]
private $createdAt;
#[ORM\Column(type: 'integer', nullable: true)]
private $createdBy;
#[ORM\Column(type: 'datetime', nullable: true)]
private $updatedAt;
#[ORM\Column(type: 'integer', nullable: true)]
private $updatedBy;
#[ORM\OneToMany(targetEntity: LeaveEntitlement::class, mappedBy: 'leaveType')]
private $leaveEntitlements;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $description;
#[ORM\Column(type: 'integer', nullable: true)]
private $parent;
#[ORM\Column(type: 'json', nullable: true)]
private $log = [];
public function __construct()
{
$this->leaveEntitlements = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getLeaveName(): ?string
{
return $this->leaveName;
}
public function setLeaveName(string $leaveName): self
{
$this->leaveName = $leaveName;
return $this;
}
public function getIsActive(): ?bool
{
return $this->isActive;
}
public function setIsActive(?bool $isActive): self
{
$this->isActive = $isActive;
return $this;
}
public function getIsMandatory(): ?bool
{
return $this->isMandatory;
}
public function setIsMandatory(?bool $isMandatory): self
{
$this->isMandatory = $isMandatory;
return $this;
}
public function getDays(): ?string
{
return $this->days;
}
public function setDays(?string $days): self
{
$this->days = $days;
return $this;
}
public function getOffice(): ?Office
{
return $this->office;
}
public function setOffice(?Office $office): self
{
$this->office = $office;
return $this;
}
public function getAttributes(): ?array
{
return $this->attributes;
}
public function setAttributes(?array $attributes): self
{
$this->attributes = $attributes;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(?\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getCreatedBy(): ?int
{
return $this->createdBy;
}
public function setCreatedBy(?int $createdBy): self
{
$this->createdBy = $createdBy;
return $this;
}
public function getUpdatedAt(): ?\DateTimeInterface
{
return $this->updatedAt;
}
public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
{
$this->updatedAt = $updatedAt;
return $this;
}
public function getUpdatedBy(): ?string
{
return $this->updatedBy;
}
public function setUpdatedBy(?string $updatedBy): self
{
$this->updatedBy = $updatedBy;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $desc): self
{
$this->description = $desc;
return $this;
}
public function getParent(): ?int
{
return $this->parent;
}
public function setParent(?int $parent): self
{
$this->parent = $parent;
return $this;
}
public function getLog(): ?array
{
return $this->log;
}
public function setLog(?array $log): self
{
$this->log = $log;
return $this;
}
/**
* @return Collection<int, LeaveEntitlement>
*/
public function getLeaveEntitlements(): Collection
{
return $this->leaveEntitlements;
}
public function addLeaveEntitlement(LeaveEntitlement $leaveEntitlement): self
{
if (!$this->leaveEntitlements->contains($leaveEntitlement)) {
$this->leaveEntitlements[] = $leaveEntitlement;
$leaveEntitlement->setLeaveType($this);
}
return $this;
}
public function removeLeaveEntitlement(LeaveEntitlement $leaveEntitlement): self
{
if ($this->leaveEntitlements->removeElement($leaveEntitlement)) {
// set the owning side to null (unless already changed)
if ($leaveEntitlement->getLeaveType() === $this) {
$leaveEntitlement->setLeaveType(null);
}
}
return $this;
}
}