<?php
namespace App\Entity;
use App\Enum\EmployeeHistory\SalaryType;
use App\Repository\EmployeeHistoryRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=EmployeeHistoryRepository::class)
*/
class EmployeeHistory
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="datetime")
*/
private $startDate;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $endDate;
/**
* @ORM\ManyToOne(targetEntity=EmployeeDepartment::class, inversedBy="employeeHistories")
* @ORM\JoinColumn(nullable=false)
*/
private $department;
/**
* @ORM\ManyToOne(targetEntity=EmployeePosition::class, inversedBy="employeeHistories")
* @ORM\JoinColumn(nullable=false)
*/
private $position;
/**
* @ORM\ManyToOne(targetEntity=Employee::class, inversedBy="employeeHistories")
*/
private $employee;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $reason;
/**
* @ORM\OneToMany(targetEntity=EmployeeSalaryBonusHistory::class, mappedBy="history")
*/
private $employeeSalaryBonusHistories;
/**
* @ORM\OneToMany(targetEntity=EmployeeHourCount::class, mappedBy="history", orphanRemoval=true)
*/
private $employeeHourCounts;
/**
* @ORM\Column(type="salaryType")
*/
private ?SalaryType $salaryType;
/**
* @ORM\Column(type="float")
*/
private $price;
public function __construct()
{
$this->employeeSalaryHistories = new ArrayCollection();
$this->employeeSalaryBonusHistories = new ArrayCollection();
$this->employeeHourCounts = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getStartDate(): ?\DateTimeInterface
{
return $this->startDate;
}
public function setStartDate(\DateTimeInterface $startDate): self
{
$this->startDate = $startDate;
return $this;
}
public function getEndDate(): ?\DateTimeInterface
{
return $this->endDate;
}
public function setEndDate(?\DateTimeInterface $endDate): self
{
$this->endDate = $endDate;
return $this;
}
public function getDepartment(): ?EmployeeDepartment
{
return $this->department;
}
public function setDepartment(?EmployeeDepartment $department): self
{
$this->department = $department;
return $this;
}
public function getPosition(): ?EmployeePosition
{
return $this->position;
}
public function setPosition(?EmployeePosition $position): self
{
$this->position = $position;
return $this;
}
public function getEmploye(): ?Employee
{
return $this->employee;
}
public function setEmploye(?Employee $employee): self
{
$this->employee = $employee;
return $this;
}
public function getReason(): ?string
{
return $this->reason;
}
public function setReason(? string $reason): self
{
$this->reason = $reason;
return $this;
}
public function getSalaryType(): ?SalaryType
{
return $this->salaryType;
}
public function setSalaryType(?SalaryType $salaryType): self
{
$this->salaryType = $salaryType;
return $this;
}
public function getPrice(): ?float
{
return $this->price;
}
public function setPrice(float $price): self
{
$this->price = $price;
return $this;
}
/**
* @return Collection<int, EmployeeSalaryBonusHistory>
*/
public function getEmployeeSalaryBonusHistories(): Collection
{
return $this->employeeSalaryBonusHistories;
}
public function addEmployeeSalaryBonusHistory(EmployeeSalaryBonusHistory $employeeSalaryBonusHistory): self
{
if (!$this->employeeSalaryBonusHistories->contains($employeeSalaryBonusHistory)) {
$this->employeeSalaryBonusHistories[] = $employeeSalaryBonusHistory;
$employeeSalaryBonusHistory->setHistory($this);
}
return $this;
}
public function removeEmployeeSalaryBonusHistory(EmployeeSalaryBonusHistory $employeeSalaryBonusHistory): self
{
if ($this->employeeSalaryBonusHistories->removeElement($employeeSalaryBonusHistory)) {
// set the owning side to null (unless already changed)
if ($employeeSalaryBonusHistory->getHistory() === $this) {
$employeeSalaryBonusHistory->setHistory(null);
}
}
return $this;
}
/**
* @return Collection<int, EmployeeHourCount>
*/
public function getEmployeeHourCounts(): Collection
{
return $this->employeeHourCounts;
}
public function addEmployeeHourCount(EmployeeHourCount $employeeHourCount): self
{
if (!$this->employeeHourCounts->contains($employeeHourCount)) {
$this->employeeHourCounts[] = $employeeHourCount;
$employeeHourCount->setHistory($this);
}
return $this;
}
public function removeEmployeeHourCount(EmployeeHourCount $employeeHourCount): self
{
if ($this->employeeHourCounts->removeElement($employeeHourCount)) {
// set the owning side to null (unless already changed)
if ($employeeHourCount->getHistory() === $this) {
$employeeHourCount->setHistory(null);
}
}
return $this;
}
}