<?php
namespace App\Entity;
use App\Repository\LeaveRequestRepository;
use Symfony\Component\Serializer\Annotation\Groups;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: LeaveRequestRepository::class)]
class LeaveRequest
{
#[Groups(['LogService'])]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[Groups(['LogService'])]
#[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'leaveRequests')]
private $user;
#[Groups(['LogService'])]
#[ORM\Column(type: 'datetime')]
private $startDate;
#[Groups(['LogService'])]
#[ORM\Column(type: 'boolean')]
private $isHalfStart;
#[Groups(['LogService'])]
#[ORM\Column(type: 'datetime')]
private $endDate;
#[Groups(['LogService'])]
#[ORM\Column(type: 'boolean')]
private $isHalfEnd;
#[Groups(['LogService'])]
#[ORM\Column(type: 'decimal', precision: 4, scale: 1)]
private $days;
#[Groups(['LogService'])]
#[ORM\Column(type: 'boolean', nullable: true)]
private $isApproved;
#[Groups(['LogService'])]
#[ORM\Column(type: 'text', nullable: true)]
private $comment;
#[ORM\Column(type: 'string', length: 128)]
private $createdBy;
#[ORM\Column(type: 'datetime')]
private $createdAt;
#[ORM\Column(type: 'datetime', nullable: true)]
private $updatedAt;
#[ORM\Column(type: 'string', length: 128, nullable: true)]
private $deletedBy;
#[Groups(['LogService'])]
#[ORM\Column(type: 'datetime', nullable: true)]
private $deletedAt;
#[Groups(['LogService'])]
#[ORM\ManyToOne(targetEntity: LeaveType::class)]
#[ORM\JoinColumn(name: 'leave_type_id', referencedColumnName: 'id')]
private $leaveType;
#[Groups(['LogService'])]
#[ORM\Column(type: 'decimal', precision: 4, scale: 1, nullable: true)]
private $daysLeft;
#[Groups(['LogService'])]
#[ORM\Column(type: 'text', nullable: true)]
private $note;
#[ORM\Column(type: 'json', nullable: true)]
private $alocation = [];
#[ORM\Column(type: 'json', nullable: true)]
private $attributes;
#[ORM\Column(type: 'datetime', nullable: true)]
private $lastReminder;
#[ORM\ManyToOne(targetEntity: User::class)]
private $updatedBy;
#[ORM\ManyToOne(targetEntity: User::class)]
private $reviewedBy;
#[ORM\Column(type: 'json', nullable: true)]
private $log = [];
public function getId(): ?int
{
return $this->id;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): self
{
$this->user = $user;
return $this;
}
public function getStartDate(): ?\DateTime
{
return $this->startDate;
}
public function setStartDate(\DateTime $startDate): self
{
$this->startDate = $startDate;
return $this;
}
public function getEndDate(): ?\DateTime
{
return $this->endDate;
}
public function setEndDate(\DateTime $endDate): self
{
$this->endDate = $endDate;
return $this;
}
public function getDays(): ?string
{
return $this->days;
}
public function setDays(string $days): self
{
$this->days = $days;
return $this;
}
public function getCreatedBy(): ?string
{
return $this->createdBy;
}
public function setCreatedBy(string $createdBy): self
{
$this->createdBy = $createdBy;
return $this;
}
public function getCreatedAt(): ?\DateTime
{
return $this->createdAt;
}
public function setCreatedAt(\DateTime $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getUpdatedAt(): ?\DateTimeInterface
{
return $this->updatedAt;
}
public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
{
$this->updatedAt = $updatedAt;
return $this;
}
public function getDeletedBy(): ?string
{
return $this->deletedBy;
}
public function setDeletedBy(string $name): self
{
$this->deletedBy = $name;
return $this;
}
public function getDeletedAt(): ?\DateTime
{
return $this->deletedAt;
}
public function setDeleteddAt(\DateTime $time): self
{
$this->deletedAt = $time;
return $this;
}
public function getIsHalfStart(): ?bool
{
return $this->isHalfStart;
}
public function setIsHalfStart(bool $isHalfStart): self
{
$this->isHalfStart = $isHalfStart;
return $this;
}
public function getIsHalfEnd(): ?bool
{
return $this->isHalfEnd;
}
public function setIsHalfEnd(bool $isHalfEnd): self
{
$this->isHalfEnd = $isHalfEnd;
return $this;
}
public function getIsApproved(): ?bool
{
return $this->isApproved;
}
public function getIsApproveds(): ?int{
$nn=1;
if($this->isApproved==0){$nn=0;}
if($nn!=0){
if($this->isApproved==null){$nn=2;}
}
return $nn;
}
public function setIsApproved(?bool $isApproved): self
{
$this->isApproved = $isApproved;
return $this;
}
public function getComment(): ?string
{
return $this->comment;
}
public function setComment(?string $comment): self
{
$this->comment = $comment;
return $this;
}
public function getLeaveType(): ?LeaveType
{
return $this->leaveType;
}
public function setLeaveType(LeaveType $leaveType): self
{
$this->leaveType = $leaveType;
return $this;
}
public function getDaysLeft(): ?string
{
return $this->daysLeft;
}
public function setDaysLeft(?string $daysLeft): self
{
$this->daysLeft = $daysLeft;
return $this;
}
public function getNote(): ?string
{
return $this->note;
}
public function setNote(?string $note): self
{
$this->note = $note;
return $this;
}
public function getAlocation(): ?array
{
return $this->alocation;
}
public function setAlocation(?array $alocation): self
{
$this->alocation = $alocation;
return $this;
}
public function getAttributes(): ?array
{
return $this->attributes;
}
public function setAttributes(?array $attributes): self
{
$this->attributes = $attributes;
return $this;
}
public function getLastReminder(): ?\DateTimeInterface
{
return $this->lastReminder;
}
public function setLastReminder(?\DateTimeInterface $lastReminder): self
{
$this->lastReminder = $lastReminder;
return $this;
}
public function getUpdatedBy(): ?User
{
return $this->updatedBy;
}
public function setUpdatedBy(?User $updatedBy): self
{
$this->updatedBy = $updatedBy;
return $this;
}
public function getReviewedBy(): ?User
{
return $this->reviewedBy;
}
public function setReviewedBy(?User $reviewedBy): self
{
$this->reviewedBy = $reviewedBy;
return $this;
}
public function getLog(): ?array
{
return $this->log;
}
public function setLog(?array $log): self
{
$this->log = $log;
return $this;
}
}