src/Entity/WorkerActivities.php line 23

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\WorkerActivitiesRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\Common\Collections\Selectable;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Doctrine\ORM\PersistentCollection;
  9. use phpDocumentor\Reflection\Types\This;
  10. use Monolog\DateTimeImmutable;
  11. use Symfony\Component\Serializer\Annotation\MaxDepth;
  12. use function PHPUnit\Framework\returnArgument;
  13. use Symfony\Component\Serializer\Annotation\Groups;
  14. // Criteria olustur...
  15. use Doctrine\Common\Collections\Criteria;
  16. /**
  17.  * @ORM\Entity(repositoryClass=WorkerActivitiesRepository::class)
  18.  */
  19. class WorkerActivities
  20. {
  21.     /**
  22.      * @ORM\Id
  23.      * @ORM\GeneratedValue
  24.      * @ORM\Column(type="integer")
  25.      * @Groups({
  26.      *      "worker.activity.core",
  27.      *      "partner.smart.active.employees",
  28.      *      "worker.manage.base",
  29.      *      "worker.actually.activity",
  30.      *      "timesheet.for.stakeholder",
  31.      *      "timesheet.for.partner",
  32.      *      "partner.selected.project",
  33.      *
  34.      *      "timesheet.collected.base",
  35.      *
  36.      *      "worker.in.project.worker.activity.base",
  37.      *
  38.      *
  39.      *      "worker.activity.substitution.worker.activity.core",
  40.      *
  41.      *     "worker_activity@core",
  42.      *     "worker_activity@base"
  43.      *
  44.      * })
  45.      */
  46.     private $id;
  47.     /**
  48.      * @ORM\ManyToOne(targetEntity=Worker::class, inversedBy="worker_activities" )
  49.      * // INFO Since cascade={"remove"} ignores the foreign key references by explicitly deleting the record.
  50.      * @ORM\JoinColumn(nullable=true, onDelete="CASCADE")
  51.      * @Groups({
  52.      *     "partner.smart.active.employees",
  53.      *     "worker.manage.base",
  54.      *     "timesheet.for.stakeholder",
  55.      *     "timesheet.for.partner",
  56.      *     "partner.selected.project",
  57.      *
  58.      *     "timesheet.collected.base",
  59.      *
  60.      *     "worker.in.project.worker.activity.worker",
  61.      *
  62.      *     "worker.activity.substitution.worker.activity.worker",
  63.      *
  64.      *     "worker.activity.worker",
  65.      *
  66.      *     "worker_activity@worker",
  67.      *
  68.      *     })
  69.      * @ORM\OrderBy({"name" = "ASC"})
  70.      */
  71.     private $worker;
  72.     /**
  73.      * @ORM\Column(type="datetime_immutable", nullable=true)
  74.      * @Groups({
  75.      *     "partner.smart.active.employees",
  76.      *     "worker.manage.base",
  77.      *     "worker.actually.activity",
  78.      *
  79.      *     "worker.activity.core",
  80.      *
  81.      *     "worker_activity@core"
  82.      * })
  83.      */
  84.     private $entry_at;
  85.     /**
  86.      * @ORM\Column(type="datetime_immutable", nullable=true)
  87.      * @Groups({
  88.      *     "partner.smart.active.employees",
  89.      *     "worker.manage.base",
  90.      *     "worker.actually.activity",
  91.      *
  92.      *     "worker.activity.core",
  93.      *
  94.      *      "worker_activity@core",
  95.      * })
  96.      */
  97.     private $exit_at;
  98.     /**
  99.      * @ORM\Column(type="datetime_immutable", nullable=true)
  100.      * @Groups({
  101.      *     "worker_activity@core"
  102.      * })
  103.      */
  104.     private $created_at;
  105.     /**
  106.      * @ORM\ManyToOne(targetEntity=Partner::class, inversedBy="worker_activities")
  107.      * @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
  108.      * @Groups({
  109.      *     "worker.actually.activity",
  110.      *     "timesheet.for.stakeholder",
  111.      *     "partner.selected.project",
  112.      *
  113.      *     "worker.in.project.worker.activity.partner",
  114.      *
  115.      *     "worker.activity.partner",
  116.      *
  117.      *     "worker_activity@partner"
  118.      *
  119.      *
  120.      *     })
  121.      */
  122.     private $partner;
  123.     /**
  124.      * @Groups({
  125.      *     "partner.smart.active.employees",
  126.      *     "worker.manage.base"
  127.      * })
  128.     */
  129.     private $editable;
  130.     /**
  131.      * @Groups({
  132.      *     "partner.smart.active.employees",
  133.      *     "worker.manage.base",
  134.      *
  135.      * })
  136.     */
  137.     private $status;
  138.     /**
  139.      * @deprecated use timesheets instead
  140.      * @ORM\OneToMany(targetEntity=WorkerTimesheet::class, mappedBy="worker_activity", cascade={"persist", "remove"})
  141.      *
  142.      * @Groups({
  143.      *     "worker.manage.base.timesheet",
  144.      *     "timesheet.for.stakeholder",
  145.      *     "timesheet.for.partner",
  146.      *
  147.      *     "project.joined.stakeholder.worker.in.project.worker.activity.timesheet",
  148.      *
  149.      *
  150.      * })
  151.      */
  152.     private $worker_timesheets;
  153.     /**
  154.      * @MaxDepth(1)
  155.      * @ORM\OneToMany(targetEntity=WorkerInProject::class, mappedBy="worker_activity", orphanRemoval=true, fetch="EXTRA_LAZY")
  156.      * @ORM\OrderBy({"id":"DESC"})
  157.      * @Groups({
  158.      *     "worker.manage.base",
  159.      *     "worker.manage.joined.projects",
  160.      *     "worker_activity@worker_in_project",
  161.      * })
  162.      *
  163.      */
  164.     private $worker_in_projects;
  165.     /**
  166.      * @ORM\Column(type="boolean", nullable=true)
  167.      * @Groups({
  168.      *     "worker.manage.base",
  169.      *     "partner.smart.active.employees",
  170.      *     "timesheet.for.stakeholder",
  171.      *
  172.      *     "worker_activity@core"
  173.      * })
  174.      */
  175.     private $guest;
  176.     /**
  177.      * @ORM\OneToMany(targetEntity=WorkerTimesheetPayments::class, mappedBy="worker_activity", orphanRemoval=true, cascade={"persist", "remove"} )
  178.      * @Groups({
  179.      *     "worker.manage.base.timesheet.payments",
  180.      *
  181.      *     "worker_activity@worker_timesheet_payments"
  182.      * })
  183.      */
  184.     private $worker_timesheet_payments;
  185.     /**
  186.      * Yıl bazında izin hakkı + önceki yıldan devir (kullanıcı kararı 2026-09-19 — sözleşme bazlı).
  187.      * Günler burada DEĞİL (Timesheet `H`); bkz. WorkerActivityLeaveEntitlement doc-block'u.
  188.      *
  189.      * @ORM\OneToMany(targetEntity=WorkerActivityLeaveEntitlement::class, mappedBy="worker_activity", orphanRemoval=true, cascade={"persist", "remove"})
  190.      * @ORM\OrderBy({"year":"DESC"})
  191.      * @Groups({
  192.      *     "worker_activity@leave_entitlements"
  193.      * })
  194.      */
  195.     private $leave_entitlements;
  196.     /**
  197.      * TODO this should be in WorkerActivities
  198.      * @ORM\OneToMany(targetEntity=ProjectOrders::class, mappedBy="order_primary_lead")
  199.      */
  200.     private $projectOrders;
  201.     /**
  202.      *
  203.      *      Bu yapı, WorkerActivities (İşçi Aktiviteleri) tablosunda bir aktivitenin başka bir aktiviteyle ilişkili
  204.      *      olduğunu belirtmek için kullanılır.
  205.      *      Bu, özellikle bir işçinin yokluğunda onun yerine geçen başka bir işçinin aktivitesini takip etmek için
  206.      *      faydalıdır.
  207.      *
  208.      * 🧱   Teknik Açıklama
  209.      *      ManyToMany İlişki: Bir aktivite birden fazla aktiviteyle ilişkili olabilir ve tersi de geçerlidir.
  210.      *      Self-Referencing: İlişki aynı tablo (WorkerActivities) içinde tanımlanmıştır.
  211.      *      JoinTable: İlişkiyi temsil eden ara tablo manuel olarak adlandırılmıştır: worker_activity_substitutions.
  212.      *      joinColumns: İlişkinin sahibi olan aktiviteyi belirtir.
  213.      *      inverseJoinColumns: İlişkinin hedefi olan aktiviteyi belirtir.
  214.      *
  215.      *      This property defines the activities that this activity *replaces* or *substitutes*.
  216.      *
  217.      *      In other words, if a worker cannot perform their original activity (e.g., due to absence),
  218.      *      this activity can take over those responsibilities. This allows tracking which activities
  219.      *      serve as substitutes for others.
  220.      *
  221.      *      The relationship is many-to-many and self-referencing within the WorkerActivities entity.
  222.      *
  223.      *      For example:
  224.      *      - Activity A substitutes Activity B and C.
  225.      *      - Activity B is substituted by Activity A.
  226.      *
  227.      *      This is the owning side of the relation.
  228.      * @MaxDepth(1)
  229.      * @ORM\ManyToMany(targetEntity=WorkerActivities::class, inversedBy="worker_substituted_activities")
  230.      * @ORM\JoinTable(
  231.      *      name="worker_activity_substitutions",
  232.      *      joinColumns={@ORM\JoinColumn(name="main_activity_id", referencedColumnName="id")},
  233.      *      inverseJoinColumns={@ORM\JoinColumn(name="substituted_activity_id", referencedColumnName="id")}
  234.      *  )
  235.      * @Groups({
  236.      *     "worker.activity.substitutions",
  237.      *
  238.      *     "worker_activity@worker_activity_substitutions"
  239.      * })
  240.     */
  241.     private $worker_activity_substitutions;
  242.     /**
  243.      * @MaxDepth(1)
  244.      * @ORM\ManyToMany(targetEntity=WorkerActivities::class, mappedBy="worker_activity_substitutions")
  245.      * @Groups({
  246.      *     "worker.activity.coverages",
  247.      *
  248.      *     "worker_activity@worker_substituted_activities"
  249.      * })
  250.      */
  251.     private $worker_substituted_activities;
  252.     /**
  253.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="worker_activities")
  254.      * @Groups({
  255.      *     "worker.activity.user",
  256.      *
  257.      *     "worker_activity@user"
  258.      * })
  259.      * @ORM\JoinColumn(onDelete="SET NULL")
  260.      */
  261.     private $user;
  262.     /**
  263.      * @ORM\Column(type="boolean", nullable=true, options={"comment": "Indicates whether the worker is accountable for the profitability performance of the Aufträge they participated in. If true, the worker's success/failure will be evaluated based on whether the project met its profit margin targets. ( Bu işçinin görev aldığı Aufträg'ların kâr hedefine ulaşıp ulaşmamasıyla ilişkilendirilmesini sağlayan bilgi alanı.)"} )
  264.      * @Groups({
  265.      *     "worker.manage.base",
  266.      *     "worker.activity.core", "worker_activity@core",
  267.      *     "partner.smart.active.employees",
  268.      *
  269.      *     "worker_activity@core"
  270.      * })
  271.      */
  272.     private $is_kpi_responsible;
  273.     /**
  274.      * @ORM\ManyToMany(targetEntity=ProjectOrders::class, mappedBy="assigned_workers")
  275.      */
  276.     private $assigned_orders;
  277.     /**
  278.      * TODO Temporarily Durduruldu Baglanti Entityler Entity_Archived icinde!
  279.      * ORM\OneToMany(targetEntity=Timesheets::class, mappedBy="worker_activity", orphanRemoval=true)
  280.      * @Groups({
  281.      *     "worker_activity@timesheets",
  282.      * })
  283.      */
  284.     private $timesheets;
  285.     /**
  286.      * @ORM\Column(type="string", length=255, nullable=true)
  287.      * @Groups({
  288.      *      "worker.activity.core",
  289.      *
  290.      *      "worker_activity@core"
  291.      *  })
  292.      *
  293.      */
  294.     private $termination_reason;
  295.     /**
  296.      * Setter over Subscriber
  297.      * @Groups({
  298.      *      "worker_activity@core"
  299.      *  })
  300.      */
  301.     private $activity_status;
  302.     /**
  303.      * Iscinin BU aktivitedeki saat ucreti — kademeli zincirin 1. halkasi.
  304.      * Doluysa tartisma biter; bos ise sirasiyla firma ucreti (iscinin PRIMARY niteligi icin,
  305.      * `partner_qualification_rate`) ve global ayar (`qualification.default_hourly_rate`) onerilir.
  306.      * Tek okuma noktasi: `App\Service\HourlyRateResolver`.
  307.      *
  308.      * @ORM\Column(type="float", nullable=true)
  309.      * @Groups({
  310.      *       "worker_activity@core"
  311.      * })
  312.      */
  313.     private $hourly_rate;
  314.     /**
  315.      * @ORM\Column(type="float", nullable=true)
  316.      * @Groups({
  317.      *        "worker_activity@core"
  318.      * })
  319.      */
  320.     private $daily_working_hours;
  321.     /**
  322.      * @ORM\OneToMany(targetEntity=StockIssue::class, mappedBy="issue_to_employee_activity")
  323.      */
  324.     private $stockIssues;
  325.     /**
  326.      * @ORM\OneToMany(targetEntity=ProjectOrderTasks::class, mappedBy="responsible_person")
  327.      */
  328.     private $project_order_tasks;
  329.     /**
  330.      * @ORM\OneToMany(targetEntity=ProjectOrderTaskFulfillment::class, mappedBy="branch_contact_person")
  331.      */
  332.     private $project_order_task_fulfillments;
  333.     /**
  334.      * Controle over Subscriber
  335.      * @return mixed
  336.      */
  337.     public function getActivityStatus()
  338.     {
  339.         return $this->activity_status;
  340.     }
  341.     /**
  342.      * Controle over Subscriber
  343.      * @param mixed $activity_status
  344.      */
  345.     public function setActivityStatus($activity_status): self
  346.     {
  347.         $this->activity_status = $activity_status;
  348.         return $this;
  349.     }
  350.     public function __construct()
  351.     {
  352.         $this->leave_entitlements = new ArrayCollection();
  353.         $this->worker_timesheets = new ArrayCollection();
  354.         $this->worker_in_projects = new ArrayCollection();
  355.         $this->worker_timesheet_payments = new ArrayCollection();
  356.         $this->projectOrders = new ArrayCollection();
  357.         $this->worker_activity_substitutions = new ArrayCollection();
  358.         $this->worker_substituted_activities = new ArrayCollection();
  359.         $this->assigned_orders = new ArrayCollection();
  360.         $this->timesheets = new ArrayCollection();
  361.         $this->stockIssues = new ArrayCollection();
  362.         $this->project_order_tasks = new ArrayCollection();
  363.         $this->project_order_task_fulfillments = new ArrayCollection();;
  364.     }
  365.     /**
  366.      * @Groups("partner.workers.smart.list")
  367.     */
  368.     public function getEditable(): bool {
  369.         return !($this->getExitAt() && $this->getExitAt() < new \DateTimeImmutable('now'));;
  370.     }
  371.     public function getStatus(): ?array {
  372.         if( !$this->getEntryAt() && !$this->getExitAt() ){
  373.             return [
  374.                 'status' => 'unknown',
  375.                 'color' => 'yellow',
  376.                 'message' => 'Unknown status'
  377.             ];
  378.         } else if( $this->getEntryAt() && !$this->getExitAt() ){
  379.             return [
  380.                 'status' => 'active',
  381.                 'color' => 'green',
  382.                 'message' => "Active since " . (new DateTimeImmutable('now'))->diff( $this->getEntryAt())->days . ' day(s)'
  383.             ];
  384.         }
  385.         else {
  386.             $today = new \DateTimeImmutable('now');
  387.             $exitAt = $this->getExitAt();
  388.             if( $exitAt && $today < $exitAt ){
  389.                 $restDay = $exitAt->diff( $today )->days;
  390.                 if( !$restDay ){
  391.                     return [
  392.                         'status' => 'inactive',
  393.                         'color' => 'red',
  394.                         'message' => "Inactive in " . $exitAt->diff( $today )->h . " Hour(s)"
  395.                     ];
  396.                 }
  397.                 return [
  398.                     'status' => 'inactive',
  399.                     'color' => 'red',
  400.                     'message' => "Inactive in " . $restDay . " Day(s)"
  401.                 ];
  402.             }
  403.         }
  404.         return [
  405.             'status' => 'inactive',
  406.             'color' => 'red',
  407.             'message' => "Inactive since " . (new DateTimeImmutable('now'))->diff( $this->getExitAt())->days . ' day(s)'
  408.         ];
  409.     }
  410.     public function getCompanyName(): ?string{
  411.         return $this->getPartner()->getCompany();
  412.     }
  413.     public function getId(): ?int
  414.     {
  415.         return $this->id;
  416.     }
  417.     public function getWorker(): ?Worker
  418.     {
  419.         return $this->worker;
  420.     }
  421.     public function setWorker(?Worker $worker): self
  422.     {
  423.         $this->worker = $worker;
  424.         return $this;
  425.     }
  426.     public function getEntryAt(): ?\DateTimeImmutable
  427.     {
  428.         return $this->entry_at;
  429.     }
  430.     public function setEntryAt(?\DateTimeImmutable $entry_at): self
  431.     {
  432.         $this->entry_at = $entry_at;
  433.         return $this;
  434.     }
  435.     public function getExitAt(): ?\DateTimeImmutable
  436.     {
  437.         return $this->exit_at;
  438.     }
  439.     public function setExitAt(?\DateTimeImmutable $exit_at): self
  440.     {
  441.         $this->exit_at = $exit_at;
  442.         return $this;
  443.     }
  444.     public function getCreatedAt(): ?\DateTimeImmutable
  445.     {
  446.         return $this->created_at;
  447.     }
  448.     public function setCreatedAt(?\DateTimeImmutable $created_at): self
  449.     {
  450.         $this->created_at = $created_at;
  451.         return $this;
  452.     }
  453.     public function getPartner(): ?Partner
  454.     {
  455.         return $this->partner;
  456.     }
  457.     public function setPartner(?Partner $partner): self
  458.     {
  459.         $this->partner = $partner;
  460.         return $this;
  461.     }
  462.     /**
  463.      * @return Collection<int, WorkerTimesheet>&Selectable
  464.      */
  465.     public function getWorkerTimesheets(): Collection
  466.     {
  467.         return $this->worker_timesheets;
  468.     }
  469.     public function addWorkerTimesheet(WorkerTimesheet $workerTimesheet): self
  470.     {
  471.         if (!$this->worker_timesheets->contains($workerTimesheet)) {
  472.             $this->worker_timesheets[] = $workerTimesheet;
  473.             $workerTimesheet->setWorkerActivity($this);
  474.         }
  475.         return $this;
  476.     }
  477.     public function removeWorkerTimesheet(WorkerTimesheet $workerTimesheet): self
  478.     {
  479.         if ($this->worker_timesheets->removeElement($workerTimesheet)) {
  480.             // set the owning side to null (unless already changed)
  481.             if ($workerTimesheet->getWorkerActivity() === $this) {
  482.                 $workerTimesheet->setWorkerActivity(null);
  483.             }
  484.         }
  485.         return $this;
  486.     }
  487.     /**
  488.      * @return Collection<int, WorkerInProject>&Selectable
  489.      */
  490.     public function getWorkerInProjects(): ?Collection
  491.     {
  492.         return $this->worker_in_projects;
  493.     }
  494.     public function addWorkerInProject(WorkerInProject $workerInProject): self
  495.     {
  496.         // dd($workerInProject);
  497.         if (!$this->worker_in_projects->contains($workerInProject)) {
  498.             $this->worker_in_projects[] = $workerInProject;
  499.             // $workerInProject->setWorker($this);
  500.             // $workerInProject->setStakeholderProject($this);
  501.             // $workerInProject->setProject($this);
  502.             $workerInProject->setWorkerActivity($this);
  503.         }
  504.         return $this;
  505.     }
  506.     public function removeWorkerInProject(WorkerInProject $workerInProject): self
  507.     {
  508.         if ($this->worker_in_projects->removeElement($workerInProject)) {
  509.             // set the owning side to null (unless already changed)
  510. //             if ($workerInProject->getWorker() === $this) {
  511. //                 $workerInProject->setWorker(null);
  512. //             }
  513.             if ($workerInProject->getWorkerActivity() === $this) {
  514.                 $workerInProject->setWorkerActivity(null);
  515.             }
  516.         }
  517.         return $this;
  518.     }
  519.     public function isGuest(): ?bool
  520.     {
  521.         return $this->guest;
  522.     }
  523.     public function setGuest(?bool $guest): self
  524.     {
  525.         $this->guest = $guest;
  526.         return $this;
  527.     }
  528.     /**
  529.      * @return Collection<int, WorkerTimesheetPayments>
  530.      */
  531.     public function getWorkerTimesheetpayments(): Collection
  532.     {
  533.         return $this->worker_timesheet_payments;
  534.     }
  535.     public function addWorkerTimesheetPayment(WorkerTimesheetPayments $workerTimesheetPayment): self
  536.     {
  537.         if (!$this->worker_timesheet_payments->contains($workerTimesheetPayment)) {
  538.             $this->worker_timesheet_payments[] = $workerTimesheetPayment;
  539.             $workerTimesheetPayment->setWorkerActivity($this);
  540.         }
  541.         return $this;
  542.     }
  543.     public function removeWorkerTimesheetPayment(WorkerTimesheetPayments $workerTimesheetPayment): self
  544.     {
  545.         if ($this->worker_timesheet_payments->removeElement($workerTimesheetPayment)) {
  546.             // set the owning side to null (unless already changed)
  547.             if ($workerTimesheetPayment->getWorkerActivity() === $this) {
  548.                 $workerTimesheetPayment->setWorkerActivity(null);
  549.             }
  550.         }
  551.         return $this;
  552.     }
  553.     /**
  554.      * @return Collection<int, ProjectOrders>
  555.      */
  556.     public function getProjectOrders(): Collection
  557.     {
  558.         return $this->projectOrders;
  559.     }
  560.     public function addProjectOrder(ProjectOrders $projectOrder): self
  561.     {
  562.         if (!$this->projectOrders->contains($projectOrder)) {
  563.             $this->projectOrders[] = $projectOrder;
  564.             $projectOrder->setOrderLead($this);
  565.         }
  566.         return $this;
  567.     }
  568.     public function removeProjectOrder(ProjectOrders $projectOrder): self
  569.     {
  570.         if ($this->projectOrders->removeElement($projectOrder)) {
  571.             // set the owning side to null (unless already changed)
  572.             if ($projectOrder->getOrderLead() === $this) {
  573.                 $projectOrder->setOrderLead(null);
  574.             }
  575.         }
  576.         return $this;
  577.     }
  578.     /**
  579.      * @return Collection<int, self>
  580.      */
  581.     public function getWorkerActivitySubstitutions(): Collection
  582.     {
  583.         return $this->worker_activity_substitutions;
  584.     }
  585.     public function addWorkerSubstitutedActivity(self $workerSubstitutedActivity): self
  586.     {
  587.         if (!$this->worker_activity_substitutions->contains($workerSubstitutedActivity)) {
  588.             $this->worker_activity_substitutions[] = $workerSubstitutedActivity;
  589.         }
  590.         return $this;
  591.     }
  592.     public function removeWorkerSubstitutedActivity(self $workerSubstitutedActivity): self
  593.     {
  594.         $this->worker_activity_substitutions->removeElement($workerSubstitutedActivity);
  595.         return $this;
  596.     }
  597.     /**
  598.      * @return Collection<int, self>
  599.      */
  600.     public function getWorkerSubstitutedActivities(): Collection
  601.     {
  602.         return $this->worker_substituted_activities;
  603.     }
  604.     public function getUser(): ?User
  605.     {
  606.         return $this->user;
  607.     }
  608.     public function setUser(?User $user): self
  609.     {
  610.         $this->user = $user;
  611.         return $this;
  612.     }
  613.     public function isIsKpiResponsible(): ?bool
  614.     {
  615.         return $this->is_kpi_responsible;
  616.     }
  617.     public function setIsKpiResponsible(?bool $is_kpi_responsible): self
  618.     {
  619.         $this->is_kpi_responsible = $is_kpi_responsible;
  620.         return $this;
  621.     }
  622.     /**
  623.      * @return Collection<int, ProjectOrders>&Selectable
  624.      */
  625.     public function getAssignedOrders(): Collection
  626.     {
  627.         return $this->assigned_orders;
  628.     }
  629.     public function addAssignedOrder(ProjectOrders $assignedOrder): self
  630.     {
  631.         if (!$this->assigned_orders->contains($assignedOrder)) {
  632.             $this->assigned_orders[] = $assignedOrder;
  633.             $assignedOrder->addAssignedWorker($this);
  634.         }
  635.         return $this;
  636.     }
  637.     public function removeAssignedOrder(ProjectOrders $assignedOrder): self
  638.     {
  639.         if ($this->assigned_orders->removeElement($assignedOrder)) {
  640.             $assignedOrder->removeAssignedWorker($this);
  641.         }
  642.         return $this;
  643.     }
  644.     /**
  645.      * @return Collection<int, Timesheets>&Selectable
  646.      */
  647.     public function getTimesheets(): ?Collection
  648.     {
  649.         return $this->timesheets;
  650.     }
  651.     public function addTimesheet(Timesheets $timesheet): self
  652.     {
  653.         if (!$this->timesheets->contains($timesheet)) {
  654.             $this->timesheets[] = $timesheet;
  655.             $timesheet->setWorkerActivity($this);
  656.         }
  657.         return $this;
  658.     }
  659.     public function removeTimesheet(Timesheets $timesheet): self
  660.     {
  661.         if ($this->timesheets->removeElement($timesheet)) {
  662.             // set the owning side to null (unless already changed)
  663.             if ($timesheet->getWorkerActivity() === $this) {
  664.                 $timesheet->setWorkerActivity(null);
  665.             }
  666.         }
  667.         return $this;
  668.     }
  669.     public function getTerminationReason(): ?string
  670.     {
  671.         return $this->termination_reason;
  672.     }
  673.     public function setTerminationReason(?string $termination_reason): self
  674.     {
  675.         $this->termination_reason = $termination_reason;
  676.         return $this;
  677.     }
  678.     public function getHourlyRate(): ?float
  679.     {
  680.         return $this->hourly_rate;
  681.     }
  682.     public function setHourlyRate(?float $hourly_rate): self
  683.     {
  684.         $this->hourly_rate = $hourly_rate;
  685.         return $this;
  686.     }
  687.     /**
  688.      * @return Collection<int, StockIssue>
  689.      */
  690.     public function getStockIssues(): Collection
  691.     {
  692.         return $this->stockIssues;
  693.     }
  694.     public function addStockIssue(StockIssue $stockIssue): self
  695.     {
  696.         if (!$this->stockIssues->contains($stockIssue)) {
  697.             $this->stockIssues[] = $stockIssue;
  698.             $stockIssue->setIssueToEmployeeActivity($this);
  699.         }
  700.         return $this;
  701.     }
  702.     public function removeStockIssue(StockIssue $stockIssue): self
  703.     {
  704.         if ($this->stockIssues->removeElement($stockIssue)) {
  705.             // set the owning side to null (unless already changed)
  706.             if ($stockIssue->getIssueToEmployeeActivity() === $this) {
  707.                 $stockIssue->setIssueToEmployeeActivity(null);
  708.             }
  709.         }
  710.         return $this;
  711.     }
  712.     public function getDailyWorkingHours(): ?float
  713.     {
  714.         return $this->daily_working_hours;
  715.     }
  716.     public function setDailyWorkingHours(?float $daily_working_hours): self
  717.     {
  718.         $this->daily_working_hours = $daily_working_hours;
  719.         return $this;
  720.     }
  721.     /**
  722.      * @return Collection<int, ProjectOrderTasks>
  723.      */
  724.     public function getProjectOrderTasks(): Collection
  725.     {
  726.         return $this->project_order_tasks;
  727.     }
  728.     public function addProjectOrderTask(ProjectOrderTasks $projectOrderTask): self
  729.     {
  730.         if (!$this->project_order_tasks->contains($projectOrderTask)) {
  731.             $this->project_order_tasks[] = $projectOrderTask;
  732.             $projectOrderTask->setResponsiblePerson($this);
  733.         }
  734.         return $this;
  735.     }
  736.     public function removeProjectOrderTask(ProjectOrderTasks $projectOrderTask): self
  737.     {
  738.         if ($this->project_order_tasks->removeElement($projectOrderTask)) {
  739.             // set the owning side to null (unless already changed)
  740.             if ($projectOrderTask->getResponsiblePerson() === $this) {
  741.                 $projectOrderTask->setResponsiblePerson(null);
  742.             }
  743.         }
  744.         return $this;
  745.     }
  746.     /**
  747.      * @return Collection<int, ProjectOrderTaskFulfillment>
  748.      */
  749.     public function getProjectOrderTaskFulfillments(): Collection
  750.     {
  751.         return $this->project_order_task_fulfillments;
  752.     }
  753.     public function addProjectOrderTaskFulfillment(ProjectOrderTaskFulfillment $projectOrderTaskFulfillment): self
  754.     {
  755.         if (!$this->project_order_task_fulfillments->contains($projectOrderTaskFulfillment)) {
  756.             $this->project_order_task_fulfillments[] = $projectOrderTaskFulfillment;
  757.             $projectOrderTaskFulfillment->setBranchContactPerson($this);
  758.         }
  759.         return $this;
  760.     }
  761.     public function removeProjectOrderTaskFulfillment(ProjectOrderTaskFulfillment $projectOrderTaskFulfillment): self
  762.     {
  763.         if ($this->project_order_task_fulfillments->removeElement($projectOrderTaskFulfillment)) {
  764.             // set the owning side to null (unless already changed)
  765.             if ($projectOrderTaskFulfillment->getBranchContactPerson() === $this) {
  766.                 $projectOrderTaskFulfillment->setBranchContactPerson(null);
  767.             }
  768.         }
  769.         return $this;
  770.     }
  771.     /** @return Collection|WorkerActivityLeaveEntitlement[] */
  772.     public function getLeaveEntitlements(): Collection
  773.     {
  774.         return $this->leave_entitlements;
  775.     }
  776.     public function addLeaveEntitlement(WorkerActivityLeaveEntitlement $entitlement): self
  777.     {
  778.         if (!$this->leave_entitlements->contains($entitlement)) {
  779.             $this->leave_entitlements[] = $entitlement;
  780.             $entitlement->setWorkerActivity($this);
  781.         }
  782.         return $this;
  783.     }
  784. }