src/Entity/EmployeeHistory.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Enum\EmployeeHistory\SalaryType;
  4. use App\Repository\EmployeeHistoryRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. /**
  9.  * @ORM\Entity(repositoryClass=EmployeeHistoryRepository::class)
  10.  */
  11. class EmployeeHistory
  12. {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @ORM\Column(type="datetime")
  21.      */
  22.     private $startDate;
  23.     /**
  24.      * @ORM\Column(type="datetime", nullable=true)
  25.      */
  26.     private $endDate;
  27.     /**
  28.      * @ORM\ManyToOne(targetEntity=EmployeeDepartment::class, inversedBy="employeeHistories")
  29.      * @ORM\JoinColumn(nullable=false)
  30.      */
  31.     private $department;
  32.     /**
  33.      * @ORM\ManyToOne(targetEntity=EmployeePosition::class, inversedBy="employeeHistories")
  34.      * @ORM\JoinColumn(nullable=false)
  35.      */
  36.     private $position;
  37.     /**
  38.      * @ORM\ManyToOne(targetEntity=Employee::class, inversedBy="employeeHistories")
  39.      */
  40.     private $employee;
  41.     /**
  42.      * @ORM\Column(type="string", length=255, nullable=true)
  43.      */
  44.     private $reason;
  45.     /**
  46.      * @ORM\OneToMany(targetEntity=EmployeeSalaryBonusHistory::class, mappedBy="history")
  47.      */
  48.     private $employeeSalaryBonusHistories;
  49.     /**
  50.      * @ORM\OneToMany(targetEntity=EmployeeHourCount::class, mappedBy="history", orphanRemoval=true)
  51.      */
  52.     private $employeeHourCounts;
  53.     /**
  54.      * @ORM\Column(type="salaryType")
  55.      */
  56.     private ?SalaryType $salaryType;
  57.     /**
  58.      * @ORM\Column(type="float")
  59.      */
  60.     private $price;
  61.     public function __construct()
  62.     {
  63.         $this->employeeSalaryHistories = new ArrayCollection();
  64.         $this->employeeSalaryBonusHistories = new ArrayCollection();
  65.         $this->employeeHourCounts = new ArrayCollection();
  66.     }
  67.     public function getId(): ?int
  68.     {
  69.         return $this->id;
  70.     }
  71.     public function getStartDate(): ?\DateTimeInterface
  72.     {
  73.         return $this->startDate;
  74.     }
  75.     public function setStartDate(\DateTimeInterface $startDate): self
  76.     {
  77.         $this->startDate $startDate;
  78.         return $this;
  79.     }
  80.     public function getEndDate(): ?\DateTimeInterface
  81.     {
  82.         return $this->endDate;
  83.     }
  84.     public function setEndDate(?\DateTimeInterface $endDate): self
  85.     {
  86.         $this->endDate $endDate;
  87.         return $this;
  88.     }
  89.     public function getDepartment(): ?EmployeeDepartment
  90.     {
  91.         return $this->department;
  92.     }
  93.     public function setDepartment(?EmployeeDepartment $department): self
  94.     {
  95.         $this->department $department;
  96.         return $this;
  97.     }
  98.     public function getPosition(): ?EmployeePosition
  99.     {
  100.         return $this->position;
  101.     }
  102.     public function setPosition(?EmployeePosition $position): self
  103.     {
  104.         $this->position $position;
  105.         return $this;
  106.     }
  107.     public function getEmploye(): ?Employee
  108.     {
  109.         return $this->employee;
  110.     }
  111.     public function setEmploye(?Employee $employee): self
  112.     {
  113.         $this->employee $employee;
  114.         return $this;
  115.     }
  116.     public function getReason(): ?string
  117.     {
  118.         return $this->reason;
  119.     }
  120.     public function setReason(? string $reason): self
  121.     {
  122.         $this->reason $reason;
  123.         return $this;
  124.     }
  125.     public function getSalaryType(): ?SalaryType
  126.     {
  127.         return $this->salaryType;
  128.     }
  129.     public function setSalaryType(?SalaryType $salaryType): self
  130.     {
  131.         $this->salaryType $salaryType;
  132.         return $this;
  133.     }
  134.     public function getPrice(): ?float
  135.     {
  136.         return $this->price;
  137.     }
  138.     public function setPrice(float $price): self
  139.     {
  140.         $this->price $price;
  141.         return $this;
  142.     }
  143.     /**
  144.      * @return Collection<int, EmployeeSalaryBonusHistory>
  145.      */
  146.     public function getEmployeeSalaryBonusHistories(): Collection
  147.     {
  148.         return $this->employeeSalaryBonusHistories;
  149.     }
  150.     public function addEmployeeSalaryBonusHistory(EmployeeSalaryBonusHistory $employeeSalaryBonusHistory): self
  151.     {
  152.         if (!$this->employeeSalaryBonusHistories->contains($employeeSalaryBonusHistory)) {
  153.             $this->employeeSalaryBonusHistories[] = $employeeSalaryBonusHistory;
  154.             $employeeSalaryBonusHistory->setHistory($this);
  155.         }
  156.         return $this;
  157.     }
  158.     public function removeEmployeeSalaryBonusHistory(EmployeeSalaryBonusHistory $employeeSalaryBonusHistory): self
  159.     {
  160.         if ($this->employeeSalaryBonusHistories->removeElement($employeeSalaryBonusHistory)) {
  161.             // set the owning side to null (unless already changed)
  162.             if ($employeeSalaryBonusHistory->getHistory() === $this) {
  163.                 $employeeSalaryBonusHistory->setHistory(null);
  164.             }
  165.         }
  166.         return $this;
  167.     }
  168.     /**
  169.      * @return Collection<int, EmployeeHourCount>
  170.      */
  171.     public function getEmployeeHourCounts(): Collection
  172.     {
  173.         return $this->employeeHourCounts;
  174.     }
  175.     public function addEmployeeHourCount(EmployeeHourCount $employeeHourCount): self
  176.     {
  177.         if (!$this->employeeHourCounts->contains($employeeHourCount)) {
  178.             $this->employeeHourCounts[] = $employeeHourCount;
  179.             $employeeHourCount->setHistory($this);
  180.         }
  181.         return $this;
  182.     }
  183.     public function removeEmployeeHourCount(EmployeeHourCount $employeeHourCount): self
  184.     {
  185.         if ($this->employeeHourCounts->removeElement($employeeHourCount)) {
  186.             // set the owning side to null (unless already changed)
  187.             if ($employeeHourCount->getHistory() === $this) {
  188.                 $employeeHourCount->setHistory(null);
  189.             }
  190.         }
  191.         return $this;
  192.     }
  193. }