src/Entity/Worker.php line 45

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\TimesheetStatusRepository;
  4. use App\Repository\WorkerRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Event\LifecycleEventArgs;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use phpDocumentor\Reflection\Types\This;
  10. use Monolog\DateTimeImmutable;
  11. use PhpParser\ErrorHandler\Collecting;
  12. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Entity;
  13. use Symfony\Component\Validator\Constraints\DateTime;
  14. use Symfony\Component\Serializer\Annotation\MaxDepth;
  15. use Symfony\Component\Serializer\Annotation\Groups;
  16. use Gedmo\Mapping\Annotation as Gedmo;
  17. use Doctrine\ORM\Mapping\Table;
  18. use Doctrine\ORM\Mapping\UniqueConstraint;
  19. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  20. use Doctrine\Common\Collections\Criteria;
  21. /**
  22.  * @ORM\Entity(repositoryClass=WorkerRepository::class)
  23.  */
  24. /**
  25.  * @ORM\HasLifecycleCallbacks
  26.  * @ORM\Entity(repositoryClass=WorkerRepository::class)
  27.  * @ORM\Table(
  28.  *     name="worker",
  29.  *     uniqueConstraints={
  30.  *          @ORM\UniqueConstraint(columns={"name", "surname", "birthday_at"}),
  31.  *          @ORM\UniqueConstraint(name="unique_personal_id", columns={"personal_id"}, options={"where": "(personal_id IS NOT NULL)"}),
  32.  *     }
  33.  * )
  34.  * @UniqueEntity(
  35.  *      fields={"name", "surname", "birthday_at"},
  36.  *      message="Employee already registered|Employee with combination (%s %s %s) is already registered"
  37.  * )
  38.  */
  39. class Worker
  40. {
  41.     // Same Process processed via Entity Subscriber
  42.     /**
  43.      * @ORM\Id
  44.      * @ORM\GeneratedValue
  45.      * @ORM\Column(type="integer")
  46.      * @Groups({
  47.      *     "worker.manage.base",
  48.      *     "partner.smart.active.employees",
  49.      *     "timesheet.for.stakeholder",
  50.      *     "worker.manage.base.timesheet",
  51.      *     "partner.selected.project",
  52.      * 
  53.      *     "project.details.orders",
  54.      *     "order.detail",
  55.      *     "order.lead",
  56.      *
  57.      *     "timesheet.collected.base",
  58.      *
  59.      *     "worker.base",
  60.      *     "worker.core",
  61.      *
  62.      *     "worker.activity.substitution.worker.activity.worker.core",
  63.      *
  64.      *     "worker@ref",
  65.      *     "worker@core",
  66.      *     "worker@base",
  67.      * })
  68.      */
  69.     private $id;
  70.     /**
  71.      * TODO replace base with core
  72.      * @ORM\Column(type="string", length=255)
  73.      * @Groups({
  74.      *     "worker.manage.base",
  75.      *     "partner.joined.projects.assigned.team.leaders",
  76.      *     "partner.manage.base.team.lead",
  77.      *     "partner.smart.active.employees",
  78.      *     "timesheet.for.stakeholder",
  79.      *     "timesheet.for.partner",
  80.      *     "partner.selected.project",
  81.      * 
  82.      *     "project.details.orders",
  83.      *     "order.detail",
  84.      *     "order.lead",
  85.      *
  86.      *     "timesheet.collected.base",
  87.      *
  88.      *     "worker.base",
  89.      *     "worker.core",
  90.      *
  91.      *     "worker.substitution.core",
  92.      *
  93.      *     "worker@ref",
  94.      *     "worker@core",
  95.      *     "worker@base"
  96.      *
  97.      * })
  98.      */
  99.     private $name;
  100.     /**
  101.      * @ORM\Column(type="string", length=255)
  102.      * @Groups({"worker.manage.base",
  103.      *     "partner.joined.projects.assigned.team.leaders",
  104.      *     "partner.manage.base.team.lead",
  105.      *     "partner.smart.active.employees",
  106.      *     "timesheet.for.stakeholder",
  107.      *     "timesheet.for.partner",
  108.      *     "partner.selected.project",
  109.      * 
  110.      *     "project.details.orders",
  111.      *     "order.detail",
  112.      * 
  113.      *     "order.lead",
  114.      *
  115.      *     "timesheet.collected.base",
  116.      *
  117.      *     "worker.base",
  118.      *     "worker.core",
  119.      *
  120.      *     "worker.substitution.core",
  121.      *
  122.      *     "worker@ref",
  123.      *     "worker@core",
  124.      *     "worker@base"
  125.      * })
  126.      */
  127.     private $surname;
  128.     /**
  129.      * Update over Subscriber 🔥
  130.      * @Groups({
  131.      *     "partner.joined.projects.assigned.team.leaders",
  132.      *     "partner.manage.base.team.lead",
  133.      *     "partner.smart.active.employees",
  134.      *     "worker.manage.base",
  135.      *     "partner.selected.project",
  136.      *
  137.      *     "project.details.orders",
  138.      *     "order.detail",
  139.      *     "order.lead",
  140.      *     "worker.substitution.core",
  141.      *
  142.      *     "worker.core",
  143.      *
  144.      *     "worker@core",
  145.      *     "worker@base"
  146.      * })
  147.      */
  148.     private $full_name;
  149.     /**
  150.      * @deprecated use in WorkerActivities
  151.      * @ORM\Column(type="datetime_immutable", nullable=true)
  152.      */
  153.     private $entry_at;
  154.     /**
  155.      * @deprecated use in WorkerActivities
  156.      * @ORM\Column(type="datetime_immutable", nullable=true)
  157.      */
  158.     private $exit_at;
  159.     /**
  160.      * @ORM\Column(type="datetime_immutable", nullable=true)
  161.      * @Groups({
  162.      *     "worker.manage.base",
  163.      *     "worker.core",
  164.      *
  165.      *     "worker@core"
  166.      * })
  167.      */
  168.     private $birthday_at;
  169.     /**
  170.      * @ORM\Column(type="string", length=255)
  171.      * @Gedmo\Slug(fields={"name", "surname"})
  172.      * @Groups({
  173.      *     "worker.manage.base",
  174.      *     "partner.smart.active.employees",
  175.      *     "worker.core",
  176.      *
  177.      *     "worker@core",
  178.      *     "worker@base"
  179.      * })
  180.      */
  181.     private $slug;
  182.     /**
  183.      * @ORM\ManyToMany(targetEntity=Qualification::class, inversedBy="workers", fetch="EXTRA_LAZY")
  184.      * @Groups({
  185.      *     "worker.manage.base",
  186.      *
  187.      *     "worker@qualifications"
  188.      * })
  189.      * @ORM\JoinColumn(onDelete="CASCADE")
  190.      */
  191.     private $qualifications;
  192.     /**
  193.      * ❌❌❌❌❌ TODO Bu kisim table halen colon cikarilmasi lazim
  194.      * @deprecated use in WorkerActivities
  195.      * ORM\OneToMany(targetEntity=WorkerInProject::class, mappedBy="worker", orphanRemoval=true, fetch="EXTRA_LAZY")
  196.      * @ORM\OrderBy({"id":"DESC"})
  197.      */
  198.     private $worker_in_projects;
  199.     /**
  200.      * @ORM\OneToMany(targetEntity=WorkerActivities::class, mappedBy="worker", cascade={"persist", "remove"}, orphanRemoval=true, fetch="EXTRA_LAZY" )
  201.      * @ORM\OrderBy({"id":"DESC"})
  202.      * @Groups({
  203.      *     "worker.manage.base",
  204.      *     "worker.actually.activity",
  205.      *     "worker.activities",
  206.      *
  207.      *     "worker@activities"
  208.      *
  209.      * })
  210.      *
  211.      */
  212.     private $worker_activities;
  213.     /**
  214.      * @deprecated use latest_activity
  215.      * Groups({"worker.actually.activity"})
  216.      */
  217.     private $worker_actually_activity;
  218.     /**
  219.      * @ORM\OneToMany(targetEntity=WorkerCertificates::class, mappedBy="worker", cascade={"persist", "remove"}, orphanRemoval=true, fetch="EXTRA_LAZY" )
  220.      * @Groups({
  221.      *     "worker.manage.base",
  222.      *
  223.      *     "worker@certificates"
  224.      * })
  225.      */
  226.     private $worker_certificates;
  227.     /**
  228.      * @deprecated use inside WorkerActivities
  229.      * ORM\OneToMany(targetEntity=WorkerTimesheet::class, mappedBy="worker_a", cascade={"persist"}, cascade={"persist", "remove"}, orphanRemoval=true, fetch="EXTRA_LAZY")
  230.      */
  231.     private $worker_timesheets;
  232.     /**
  233.      * ⚠️ TODO Bu alan ismi deprecated
  234.      * @deprecated this is worker_activity daily_working_hours
  235.      *  Bu alan Isciye ozel onun default calisma saati ama her Activity icin farkil olabilir
  236.      * @ORM\Column(type="decimal", precision=4, scale=2, nullable=true)
  237.      * @Groups({
  238.      *     "worker.manage.base",
  239.      *
  240.      *     "worker@core"
  241.      * })
  242.      */
  243.     private $daily_work_time;
  244.     /**
  245.      *  ⚠️ TODO Bu alan ismi deprecated
  246.      * @deprecated this is worker_activity hourly_rate
  247.      * Bu alan Isciye ozel onun default calisma ucreti ama her Activity icin farkil olabilir, ayrica her proje icinde
  248.      * @ORM\Column(type="decimal", precision=7, scale=2, nullable=true)
  249.      * @Groups({
  250.      *     "worker.manage.base",
  251.      *     "worker.manage.selected.worker.in.project",
  252.      *     "worker.manage.joined.projects",
  253.      *
  254.      *     "worker@core"
  255.      * })
  256.      */
  257.     private $cost_per_hour;
  258.     /**
  259.      * @ORM\Column(type="string", length=64, nullable=true, unique=false )
  260.      * @Groups({
  261.      *     "worker.manage.base",
  262.      *
  263.      *     "worker@core"
  264.      * })
  265.      */
  266.     private $personal_id;
  267.     // Additional param
  268.     private array $total_worked_time;
  269.     /**
  270.      * @ORM\Column(type="datetime_immutable", nullable=true)
  271.      * @Groups({
  272.      *      "worker@core"
  273.      *  })
  274.      */
  275.     private $created_at;
  276.     /**
  277.      * @ORM\Column(type="string", length=24 , nullable=true )
  278.      * @Groups({
  279.      *     "worker.manage.base",
  280.      *
  281.      *     "worker@core"
  282.      * })
  283.      */
  284.     private $phone_number;
  285.     /**
  286.      * @ORM\Column(type="string", length=255, nullable=true)
  287.      * @Groups({
  288.      *     "worker.manage.base",
  289.      *
  290.      *     "worker@core"
  291.      * })
  292.      */
  293.     private $uiid;
  294.     /**
  295.      * MUTATE THIS
  296.      * @ORM\Column(type="string", length=255, nullable=true)
  297.      * @Groups({
  298.      *     "worker.manage.base",
  299.      *     "partner.smart.active.employees",
  300.      *
  301.      *     "worker@core",
  302.      *     "worker@base"
  303.      * })
  304.      */
  305.     private $profile_image;
  306.     /**
  307.      * ____________________________________________________________________________________________________
  308.      * @deprecated use Original Filed And Mutate is over Subscriber
  309.      *
  310.      * Event Listener Prop
  311.      * This prop Update during event.listener
  312.      * @Groups({
  313.      *     "worker.manage.base",
  314.      *     "partner.smart.active.employees",
  315.      *
  316.      *     "worker@core"
  317.      * })
  318.      */
  319.     private $profile_image_full_path;
  320.     /**
  321.      * @deprecated use Original Filed And Mutate is over Subscriber use profile_image instead
  322.      * TODO bu ozellik EventListernes yada Subscriber uzerinden yapilacak
  323.      * Event Listener Prop
  324.      * This prop Update during event.listener
  325.      * @param string $profile_image_full_path
  326.      * @return Worker|null
  327.      */
  328.     public function setProfileImageFullPathstring $profile_image_full_path ): ?self {
  329.         $this->profile_image_full_path $profile_image_full_path;//  $this->getServiceArgumentFileDirs()['fetch'] . DIRECTORY_SEPARATOR . $this->getProfileImage();
  330.         return $this;
  331.     }
  332.     /**
  333.      * @deprecated use Original Filed And Mutate is over Subscriber use profile_image instead
  334.      * Event Listener Prop
  335.      */
  336.     public function getProfileImageFullPath(): ?string { return $this->profile_image_full_path/* $this->getServiceArgumentFileDirs()['fetch'] . DIRECTORY_SEPARATOR . $this->getProfileImage(); */ }
  337.     //  ____________________________________________________________________________________________________
  338.     /**
  339.      * TODO here 🔥worker activity uzerinden degil !!!
  340.      * @ORM\OneToMany(targetEntity=UserAppSettings::class, mappedBy="worker")
  341.      * @Groups({
  342.      *     "worker@user_app_settings"
  343.      *  })
  344.      */
  345.     private $user_app_settings;
  346.     /**
  347.      * @deprecated use in worker activity
  348.      * @ORM\ManyToMany(targetEntity=AccessRoles::class, inversedBy="workers")
  349.      */
  350.     private $worker_accessed_roles;
  351.     /**
  352.      * TODO islemler bittikten sonra cikar
  353.      * TODO this should be in WorkerActivities
  354.      * @ORM\OneToMany(targetEntity=ProjectOrders::class, mappedBy="order_lead")
  355.      */
  356.     private $projectOrders;
  357.     /**
  358.      * TODO thisi deprecated !!!!
  359.      * @deprecated use inside WorkerActivities
  360.      * @ORM\OneToOne(targetEntity=User::class, inversedBy="worker", cascade={"persist", "remove"})
  361.      * @Groups({
  362.      *     "worker.user",
  363.      * })
  364.      */
  365.     private $user;
  366.     /**
  367.      * ⚠️ Update over Subscriber
  368.      * @Groups({
  369.      *     "worker.latest.activity",
  370.      *     "worker@latest_activity"
  371.      * })
  372.     */
  373.     private $latest_activity;
  374.     /**
  375.      * @ORM\Column(type="string", length=255, nullable=true)
  376.      * @Groups({
  377.      *       "worker@core"
  378.      * })
  379.      */
  380.     private $email;
  381.     /**
  382.      * @param mixed $latest_activity
  383.      */
  384.     public function setLatestActivity(?WorkerActivities $latest_activity): self
  385.     {
  386.         $this->latest_activity $latest_activity;
  387.         return $this;
  388.     }
  389.     public function getLatestActivity(): ?WorkerActivities
  390.     {
  391.         return $this->latest_activity;
  392.     }
  393.     /**
  394.      * @return mixed
  395.      */
  396.     public function getTotalWorkedTime(): array
  397.     {
  398.         return $this->total_worked_time;
  399.     }
  400.     /**
  401.      * @param mixed $total_worked_time
  402.      */
  403.     public function setTotalWorkedTime( \DateInterval $total_worked_time ): void
  404.     {
  405.         $this->total_worked_time = [
  406.             "days" => $total_worked_time->days,
  407.             "month" => $total_worked_time->m,
  408.             "year" => $total_worked_time->y,
  409.         ];
  410.     }
  411.     /**
  412.      * @return mixed
  413.      */
  414.     public function getFullName()
  415.     {
  416.         return $this->full_name ?? $this->name " " $this->surname;
  417.     }
  418.     /**
  419.      * @param mixed $full_name
  420.      */
  421.     public function setFullName($full_name): self
  422.     {
  423.         $this->full_name $full_name;
  424.         return $this;
  425.     }
  426.     public function __construct()
  427.     {
  428.         $this->qualifications = new ArrayCollection();
  429.         $this->projects = new ArrayCollection();
  430.         $this->worker_in_projects = new ArrayCollection();
  431.         $this->worker_activities = new ArrayCollection();
  432.         $this->worker_certificates = new ArrayCollection();
  433.         $this->worker_timesheets = new ArrayCollection();
  434.         $this->user_app_settings = new ArrayCollection();
  435.         $this->role = new ArrayCollection();
  436.         $this->worker_accessed_roles = new ArrayCollection();
  437.         // TODO this should be in WorkerActivities
  438.         $this->projectOrders = new ArrayCollection();
  439.         // $this->ordersWithDelegatedAccess = new ArrayCollection();
  440.     }
  441.     public function getId(): ?int
  442.     {
  443.         return $this->id;
  444.     }
  445.     public function getName(): ?string
  446.     {
  447.         return $this->name;
  448.     }
  449.     public function setName(string $name): self
  450.     {
  451.         $this->name $name;
  452.         return $this;
  453.     }
  454.     public function getSurname(): ?string
  455.     {
  456.         return $this->surname;
  457.     }
  458.     public function setSurname(string $surname): self
  459.     {
  460.         $this->surname $surname;
  461.         return $this;
  462.     }
  463.     public function getEntryAt(): ?\DateTimeImmutable
  464.     {
  465.         return $this->entry_at;
  466.     }
  467.     public function setEntryAt(?\DateTimeImmutable $entry_at): self
  468.     {
  469.         $this->entry_at $entry_at;
  470.         return $this;
  471.     }
  472.     public function getExitAt(): ?\DateTimeImmutable
  473.     {
  474.         return $this->exit_at;
  475.     }
  476.     public function setExitAt(?\DateTimeImmutable $exit_at): self
  477.     {
  478.         $this->exit_at $exit_at;
  479.         return $this;
  480.     }
  481.     public function getBirthdayAt(): ?\DateTimeImmutable
  482.     {
  483.         return $this->birthday_at;
  484.         // return (new \DateTimeImmutable($this->birthday_at))->format('d.m.Y');
  485.     }
  486.     public function setBirthdayAt(?\DateTimeImmutable $birthday_at): self
  487.     {
  488.         $this->birthday_at $birthday_at;
  489.         return $this;
  490.     }
  491.     public function getSlug(): ?string
  492.     {
  493.         return $this->slug;
  494.     }
  495.     public function setSlug(string $slug): self
  496.     {
  497.         $this->slug $slug;
  498.         return $this;
  499.     }
  500.     /**
  501.      * @return Collection<int, Qualification>
  502.      */
  503.     public function getQualifications(): ?Collection
  504.     {
  505.             return $this->qualifications;
  506.     }
  507.     public function addQualification(Qualification $qualification): self
  508.     {
  509.         if (!$this->qualifications->contains($qualification)) {
  510.             $this->qualifications[] = $qualification;
  511.         }
  512.         return $this;
  513.     }
  514.     public function removeQualification(Qualification $qualification): self
  515.     {
  516.         $this->qualifications->removeElement($qualification);
  517.         return $this;
  518.     }
  519.     /**
  520.      * @return Collection<int, WorkerInProject>
  521.      */
  522.     public function getWorkerInProjects(): ?Collection
  523.     {
  524.         return $this->worker_in_projects;
  525.     }
  526.     public function addWorkerInProject(WorkerInProject $workerInProject): self
  527.     {
  528.         if (!$this->worker_in_projects->contains($workerInProject)) {
  529.             $this->worker_in_projects[] = $workerInProject;
  530.             $workerInProject->setWorker($this);
  531.         }
  532.         return $this;
  533.     }
  534.     public function removeWorkerInProject(WorkerInProject $workerInProject): self
  535.     {
  536.         if ($this->worker_in_projects->removeElement($workerInProject)) {
  537.             // set the owning side to null (unless already changed)
  538.             if ($workerInProject->getWorker() === $this) {
  539.                 $workerInProject->setWorker(null);
  540.             }
  541.         }
  542.         return $this;
  543.     }
  544.     /**
  545.      * @return Collection<int, WorkerActivities>
  546.      */
  547.     public function getWorkerActivities(): Collection
  548.     {
  549.         return $this->worker_activities;
  550.     }
  551.     /**
  552.      * @deprecated use worker_actually_activity
  553.      * @return Collection<int, WorkerActivities>
  554.      */
  555.     public function getWorkerActuallyPartner(): ?Partner
  556.     {
  557.         #dd($this->getWorkerActuallyActivity()['entity']->getPartner());
  558.         return $this->getWorkerActuallyActivity() ? $this->getWorkerActuallyActivity()['entity']->getPartner() : null;
  559.     }
  560.     /**
  561.      * ¨@deprecated use latest_activity
  562.     */
  563.     public function setWorkerActuallyActivityWorkerActivities $workerActivity ): void
  564.     {
  565.         $this->worker_actually_activity $workerActivity;
  566.     }
  567.     /**
  568.      * ¨@deprecated use latest_activity
  569.      */
  570.     public function getWorkerActuallyActivity()
  571.     {
  572.        // return $this->worker_actually_activity;
  573. //        $arr = $this->getWorkerActivities()->filter( function ( /**@var $workerActivity WorkerActivities*/ $workerActivity ){
  574. //            return is_null($workerActivity->getExitAt());
  575. //        })->toArray();
  576.         $simplified $this->getWorkerActivities()->map( function ( /**@var $workerActivity WorkerActivities*/ $workerActivity ){
  577.             return [
  578.                 "id" => $workerActivity->getId(),
  579.                 "entry_at" => $workerActivity->getEntryAt(),
  580.                 "exit_at" => $workerActivity->getExitAt(),
  581.                 "created_at" => $workerActivity->getCreatedAt(),
  582.                 "entity" => $workerActivity
  583.             ];
  584.         })->toArray();
  585.         usort($simplified, fn($a$b) => $b['created_at'] <=> $a['created_at']); // ID'ye göre azalan sıralama
  586.         return $simplified[0] ?? null// ID'si en büyük olan
  587.     }
  588.     public function addWorkerActivity(WorkerActivities $workerActivity): self
  589.     {
  590.         if (!$this->worker_activities->contains($workerActivity)) {
  591.             $this->worker_activities[] = $workerActivity;
  592.             $workerActivity->setWorker($this);
  593.         }
  594.         return $this;
  595.     }
  596.     public function removeWorkerActivity(WorkerActivities $workerActivity): self
  597.     {
  598.         if ($this->worker_activities->removeElement($workerActivity)) {
  599.             // set the owning side to null (unless already changed)
  600.             if ($workerActivity->getWorker() === $this) {
  601.                 $workerActivity->setWorker(null);
  602.             }
  603.         }
  604.         return $this;
  605.     }
  606.     /**
  607.      * @return Collection<int, WorkerCertificates>
  608.      */
  609.     public function getWorkerCertificates(): Collection
  610.     {
  611.         return $this->worker_certificates;
  612.     }
  613.     public function addWorkerCertificate(WorkerCertificates $workerCertificate): self
  614.     {
  615.         if (!$this->worker_certificates->contains($workerCertificate)) {
  616.             $this->worker_certificates[] = $workerCertificate;
  617.             $workerCertificate->setWorker($this);
  618.         }
  619.         return $this;
  620.     }
  621.     public function removeWorkerCertificate(WorkerCertificates $workerCertificate): self
  622.     {
  623.         if ($this->worker_certificates->removeElement($workerCertificate)) {
  624.             // set the owning side to null (unless already changed)
  625.             if ($workerCertificate->getWorker() === $this) {
  626.                 $workerCertificate->setWorker(null);
  627.             }
  628.         }
  629.         return $this;
  630.     }
  631.     /**
  632.      * @return Collection<int, WorkerTimesheet>
  633.      */
  634.     public function getWorkerTimesheets(): ?Collection
  635.     {
  636.         return $this->worker_timesheets;
  637.     }
  638.     public function addWorkerTimesheet(WorkerTimesheet $workerTimesheet): self
  639.     {
  640.         if (!$this->worker_timesheets->contains($workerTimesheet)) {
  641.             $this->worker_timesheets[] = $workerTimesheet;
  642.             $workerTimesheet->setWorker($this);
  643.         }
  644.         return $this;
  645.     }
  646.     public function removeWorkerTimesheet(WorkerTimesheet $workerTimesheet): self
  647.     {
  648.         if ($this->worker_timesheets->removeElement($workerTimesheet)) {
  649.             // set the owning side to null (unless already changed)
  650.             if ($workerTimesheet->getWorker() === $this) {
  651.                 $workerTimesheet->setWorker(null);
  652.             }
  653.         }
  654.         return $this;
  655.     }
  656.     public function getCostPerHour(): ?float
  657.     {
  658.         return $this->cost_per_hour;
  659.     }
  660.     public function setCostPerHour(?float $cost_per_hour): self
  661.     {
  662.         $this->cost_per_hour $cost_per_hour;
  663.         return $this;
  664.     }
  665.     public function getDailyWorkTime(): ?float
  666.     {
  667.         return $this->daily_work_time;
  668.     }
  669.     public function setDailyWorkTime(?float $daily_work_time): self
  670.     {
  671.         $this->daily_work_time $daily_work_time;
  672.         return $this;
  673.     }
  674.     public function getPersonalId(): ?string
  675.     {
  676.         return $this->personal_id;
  677.     }
  678.     public function setPersonalId(?string $personal_id): self
  679.     {
  680.         $this->personal_id $personal_id;
  681.         return $this;
  682.     }
  683.     public function getCreatedAt(): ?\DateTimeImmutable
  684.     {
  685.         return $this->created_at;
  686.     }
  687.     public function setCreatedAt(\DateTimeImmutable $created_at): self
  688.     {
  689.         $this->created_at $created_at;
  690.         return $this;
  691.     }
  692.     public function getPhoneNumber(): ?string
  693.     {
  694.         return $this->phone_number;
  695.     }
  696.     public function setPhoneNumber(?string $phone_number): self
  697.     {
  698.         $this->phone_number $phone_number;
  699.         return $this;
  700.     }
  701.     public function getUiid(): ?string
  702.     {
  703.         return $this->uiid;
  704.     }
  705.     public function setUiid(?string $uiid): self
  706.     {
  707.         $this->uiid $uiid;
  708.         return $this;
  709.     }
  710.     public function getProfileImage(): ?string
  711.     {
  712.         return $this->profile_image;
  713.     }
  714.     public function setProfileImage(?string $profile_image): self
  715.     {
  716.         $this->profile_image $profile_image;
  717.         return $this;
  718.     }
  719.     /**
  720.      * @return Collection<int, UserAppSettings>
  721.      */
  722.     public function getUserAppSettings(): Collection
  723.     {
  724.         return $this->user_app_settings;
  725.     }
  726.     public function addUserAppSetting(UserAppSettings $userAppSetting): self
  727.     {
  728.         if (!$this->user_app_settings->contains($userAppSetting)) {
  729.             $this->user_app_settings[] = $userAppSetting;
  730.             $userAppSetting->setWorker($this);
  731.         }
  732.         return $this;
  733.     }
  734.     public function removeUserAppSetting(UserAppSettings $userAppSetting): self
  735.     {
  736.         if ($this->user_app_settings->removeElement($userAppSetting)) {
  737.             // set the owning side to null (unless already changed)
  738.             if ($userAppSetting->getWorker() === $this) {
  739.                 $userAppSetting->setWorker(null);
  740.             }
  741.         }
  742.         return $this;
  743.     }
  744.     /**
  745.      * @return Collection<int, AccessRoles>
  746.      */
  747.     public function getWorkerAccessedRoles(): Collection
  748.     {
  749.         return $this->worker_accessed_roles;
  750.     }
  751.     public function addWorkerAccessedRole(AccessRoles $workerAccessedRole): self
  752.     {
  753.         if (!$this->worker_accessed_roles->contains($workerAccessedRole)) {
  754.             $this->worker_accessed_roles[] = $workerAccessedRole;
  755.         }
  756.         return $this;
  757.     }
  758.     public function removeWorkerAccessedRole(AccessRoles $workerAccessedRole): self
  759.     {
  760.         $this->worker_accessed_roles->removeElement($workerAccessedRole);
  761.         return $this;
  762.     }
  763.     /**
  764.      * // TODO this should be in WorkerActivities
  765.      * @return Collection<int, ProjectOrders>
  766.      */
  767.     public function getProjectOrders(): Collection
  768.     {
  769.         return $this->projectOrders;
  770.     }
  771.     // TODO this should be in WorkerActivities
  772.     public function addProjectOrder(ProjectOrders $projectOrder): self
  773.     {
  774.         if (!$this->projectOrders->contains($projectOrder)) {
  775.             $this->projectOrders[] = $projectOrder;
  776.             $projectOrder->setOrderLead($this);
  777.         }
  778.         return $this;
  779.     }
  780.     // TODO this should be in WorkerActivities
  781.     public function removeProjectOrder(ProjectOrders $projectOrder): self
  782.     {
  783.         if ($this->projectOrders->removeElement($projectOrder)) {
  784.             // set the owning side to null (unless already changed)
  785.             if ($projectOrder->getOrderLead() === $this) {
  786.                 $projectOrder->setOrderLead(null);
  787.             }
  788.         }
  789.         return $this;
  790.     }
  791.     public function getUser(): ?User
  792.     {
  793.         return $this->user;
  794.     }
  795.     public function setUser(?User $user): self
  796.     {
  797.         $this->user $user;
  798.         return $this;
  799.     }
  800.     public function getEmail(): ?string
  801.     {
  802.         return $this->email;
  803.     }
  804.     public function setEmail(?string $email): self
  805.     {
  806.         $this->email $email;
  807.         return $this;
  808.     }
  809. }