src/Entity/User.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Service\RecruitmentStatus;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Symfony\Component\Security\Core\User\UserInterface;
  8. use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
  9. use Symfony\Component\Serializer\Annotation\Groups;
  10. use Symfony\Component\Serializer\Annotation\MaxDepth;
  11. use Symfony\Component\Validator\Constraints as Assert;
  12. use Exception;
  13. #[ORM\Entity(repositoryClass'App\Repository\UserRepository')]
  14. class User implements UserInterfacePasswordAuthenticatedUserInterface
  15. {
  16.     #[Groups(['LogService''EmailSchedule''UserInfo''Basic''Recruitment'])]
  17.     #[ORM\Id]
  18.     #[ORM\GeneratedValue]
  19.     #[ORM\Column(type'integer')]
  20.     private $id;
  21.     #[Groups(['LogService''EmailSchedule''UserInfo''Basic''Recruitment'])]
  22.     #[ORM\Column(type'string'length128uniquetrue)]
  23.     private $email;
  24.     #[ORM\Column(type'string'length128uniquetrue)]
  25.     private $canonicalEmail;
  26.     #[ORM\Column(type'boolean'nullabletrue)]
  27.     private $emailValidated;
  28.     #[ORM\Column(type'string'length255uniquetruenullabletrue)]
  29.     private $password;
  30.     #[Assert\Length(max4096)]
  31.     private $plainPassword;
  32.     #[Groups(['UserInfo'])]
  33.     #[ORM\Column(type'boolean')]
  34.     private $isActive;
  35.     #[Groups(['UserInfo'])]
  36.     #[ORM\Column(type'array'nullabletrue)]
  37.     private $roles = [];
  38.     #[ORM\Column(type'string'length50nullabletrue)]
  39.     private $confirmationToken;
  40.     #[ORM\Column(type'string'length50nullabletrue)]
  41.     private $forgetToken;
  42.     #[ORM\Column(type'datetime'nullabletrue)]
  43.     private $createdAt;
  44.     #[ORM\Column(type'datetime'nullabletrue)]
  45.     private $lastActivityAt;
  46.     #[MaxDepth(1)]
  47.     #[Groups(['EmailSchedule''UserInfo''Recruitment'])]
  48.     #[ORM\OneToOne(targetEntity'App\Entity\PersonalInfo'mappedBy'user'fetch'EXTRA_LAZY'cascade: ['persist''remove'])]
  49.     private $personalInfo;
  50.     #[MaxDepth(1)]
  51.     #[Groups(['UserInfo'])]
  52.     #[ORM\ManyToOne(targetEntity'App\Entity\Office'inversedBy'users'fetch'EXTRA_LAZY')]
  53.     private $office;
  54.     #[ORM\OneToMany(targetEntity'App\Entity\Company'mappedBy'user'orphanRemovaltrue)]
  55.     private $company;
  56.     #[ORM\Column(type'datetime'nullabletrue)]
  57.     private $lastLoginAt;
  58.     #[ORM\OneToMany(targetEntity'App\Entity\Invitation'mappedBy'inviter')]
  59.     private $invitations;
  60.     #[ORM\OneToMany(targetEntity'App\Entity\Document'mappedBy'user')]
  61.     private $documents;
  62.     #[ORM\OneToMany(targetEntity'App\Entity\Organization'mappedBy'user'orphanRemovaltrue)]
  63.     private $organizations;
  64.     #[ORM\OneToMany(targetEntity'App\Entity\Objective'mappedBy'user'orphanRemovaltrue)]
  65.     private $objectives;
  66.     #[ORM\OneToMany(targetEntity'App\Entity\Appraisal'mappedBy'user'orphanRemovaltrue)]
  67.     #[ORM\OrderBy(['createdAt' => 'DESC'])]
  68.     private $appraisals;
  69.     #[ORM\Column(type'string'length255nullabletrue)]
  70.     private $googleId;
  71.     #[ORM\Column(type'text'nullabletrue)]
  72.     private $temporaryPicture;
  73.     #[ORM\Column(type'string'length32nullabletrue)]
  74.     private $status;
  75.     #[ORM\OneToMany(targetEntityLog::class, mappedBy'owner'cascade: ['persist''remove'])]
  76.     private $logs;
  77.     #[MaxDepth(1)]
  78.     #[Groups(['UserInfo'])]
  79.     #[ORM\ManyToOne(targetEntityUser::class, inversedBy'subordinate')]
  80.     private $manager;
  81.     #[ORM\OneToMany(targetEntityUser::class, mappedBy'manager')]
  82.     private $subordinate;
  83.     #[ORM\OneToMany(targetEntityNotification::class, mappedBy'user')]
  84.     private $notifications;
  85.     #[ORM\OneToMany(targetEntityCertification::class, mappedBy'user'orphanRemovaltrue)]
  86.     private $certifications;
  87.     #[ORM\OneToMany(targetEntityFlexiWorkArrangementRequest::class, mappedBy'user')]
  88.     private $flexiWorkArrangementRequest;
  89.     #[ORM\ManyToMany(targetEntity'User')]
  90.     #[ORM\JoinColumn(name'sub_manager_id'referencedColumnName'id'nullabletrue)]
  91.     private $subManager;
  92.     #[ORM\OneToMany(targetEntityJob::class, mappedBy'createdBy')]
  93.     private $jobs;
  94.     #[ORM\OneToOne(targetEntityFlexiWorkArrangementOption::class, mappedBy'user'cascade: ['persist''remove'])]
  95.     private $flexiWorkArrangementOption;
  96.     #[Groups(['UserInfo'])]
  97.     #[ORM\Column(type'string'length255nullabletrue)]
  98.     private $fwaStatus;
  99.     #[ORM\Column(type'array'nullabletrue)]
  100.     private $reminder = [];
  101.     #[ORM\Column(type'boolean')]
  102.     private $featureDocumentManagement false;
  103.     #[ORM\OneToMany(targetEntityLeaveEntitlement::class, mappedBy'user'orphanRemovaltrue)]
  104.     private $leaveEntitlements;
  105.     #[ORM\OneToMany(targetEntityLeaveRequest::class, mappedBy'user')]
  106.     private $leaveRequests;
  107.     #[ORM\OneToMany(targetEntityLeaveMCRecord::class, mappedBy'user'orphanRemovaltrue)]
  108.     private $leaveMCRecords;
  109.     #[ORM\ManyToOne(targetEntityDepartment::class, inversedBy'users')]
  110.     private $department;
  111.     #[ORM\OneToMany(targetEntityAppraisalQuestionnaire::class, mappedBy'user')]
  112.     private $appraisalQuestionnaires;
  113.     #[ORM\OneToMany(targetEntityTimeSpent::class, mappedBy'user')]
  114.     private $timeSpents;
  115.     #[ORM\OneToMany(targetEntityTask::class, mappedBy'user')]
  116.     private $tasks;
  117.     #[ORM\OneToMany(targetEntityProject::class, mappedBy'createdBy')]
  118.     private $projects;
  119.     #[ORM\OneToMany(targetEntityPurchaseOrder::class, mappedBy'createdBy')]
  120.     private $purchaseOrders;
  121.     #[ORM\OneToMany(targetEntityProject::class, mappedBy'personInCharge')]
  122.     private $projectsUserIsPIC;
  123.     #[ORM\OneToMany(targetEntityVendorQuotation::class, mappedBy'createdBy')]
  124.     private $vendorQuotations;
  125.     #[ORM\OneToOne(targetEntityJobInfo::class, mappedBy'user'cascade: ['persist''remove'])]
  126.     private $jobInfo;
  127.     #[ORM\Column(type'array'nullabletrue)]
  128.     private $permission = [];
  129.     #[ORM\OneToMany(targetEntitySalary::class, mappedBy'user')]
  130.     private $salaries;
  131.     #[ORM\OneToMany(targetEntityProjectMember::class, mappedBy'user')]
  132.     private $projectMembers;
  133.     #[ORM\Column(type'json'nullabletrue)]
  134.     private $appraisalStatus = [];
  135.     #[ORM\Column(type'json'nullabletrue)]
  136.     private $objectiveStatus = [];
  137.     #[ORM\OneToMany(targetEntityUserTitle::class, mappedBy'user'orphanRemovaltrue)]
  138.     private $userTitles;
  139.     #[ORM\OneToMany(targetEntityAssetUsage::class, mappedBy'user')]
  140.     private $assetUsages;
  141.     #[ORM\OneToMany(targetEntityCourseUserEnrollment::class, mappedBy'user')]
  142.     private $courseUserEnrollments;
  143.     #[ORM\Column(type'boolean'nullabletrue)]
  144.     private $isManager;
  145.     #[ORM\OneToMany(mappedBy'Requester'targetEntityExpenseRequest::class)]
  146.     private Collection $expenseRequests;
  147.     #[ORM\OneToMany(mappedBy'commentRejectedBy'targetEntityRecruitApplication::class)]
  148.     private Collection $recruitApplicationComments;
  149.     #[ORM\OneToMany(mappedBy'commentsWithdrawnBy'targetEntityRecruitApplication::class)]
  150.     private Collection $recruitApplicationWithdrawComments;
  151.     #[ORM\OneToMany(mappedBy'user'targetEntityRecruitVacancyHiringmanager::class, orphanRemovaltrue)]
  152.     private Collection $recruitVacancyHiringmanagers;
  153.     #[ORM\OneToMany(mappedBy'approver'targetEntityRecruitVacancyApprover::class, orphanRemovaltrue)]
  154.     private Collection $recruitVacancyApprovers;
  155.     #[ORM\OneToMany(mappedBy'createdBy'targetEntityRecruitVacancy::class)]
  156.     private Collection $recruitVacancies;
  157.     #[ORM\OneToMany(mappedBy'createdBy'targetEntityRecruitApplicationActivity::class)]
  158.     private Collection $recruitApplicationActivities;
  159.     #[ORM\OneToMany(mappedBy'commentBy'targetEntityRecruitApplicationComment::class, orphanRemovaltrue)]
  160.     private Collection $recruitApplicationCommentsMultiple;
  161.     #[ORM\OneToMany(mappedBy'createdBy'targetEntityRecruitQuestion::class)]
  162.     private Collection $recruitQuestions;
  163.     #[ORM\OneToMany(mappedBy'user'targetEntityRecruitEvaluationScore::class, orphanRemovaltrue)]
  164.     private Collection $recruitEvaluationScores;
  165.     #[ORM\OneToMany(mappedBy'reportingTo'targetEntityRecruitApplication::class)]
  166.     private Collection $recruitApplications;
  167.     #[ORM\OneToMany(mappedBy'user'targetEntityRecruitDefaultApprover::class, orphanRemovaltrue)]
  168.     private Collection $defaultApprovers;
  169.     #[ORM\OneToMany(mappedBy'createdBy'targetEntityRecruitVacancyHistory::class, orphanRemovaltrue)]
  170.     private Collection $recruitVacancyHistories;
  171.     #[ORM\OneToMany(mappedBy'User'targetEntityRecruitSettingActivity::class)]
  172.     private Collection $recruitSettingActivities;
  173.     #[ORM\OneToMany(mappedBy'user'targetEntityRecruitTalentSearchSession::class, orphanRemovaltrue)]
  174.     private Collection $recruitTalentSearchSessions;
  175.     #[ORM\OneToMany(mappedBy'interviewer'targetEntityRecruitApplication::class)]
  176.     private Collection $applicationsAsInterviewer;
  177.     #[ORM\OneToMany(mappedBy'hrInterviewer'targetEntityRecruitApplication::class)]
  178.     private Collection $hrInterviewer;
  179.     #[ORM\OneToMany(mappedBy'user'targetEntityWorkingFromAbroad::class)]
  180.     private Collection $workingFromAbroads;
  181.     #[ORM\OneToMany(mappedBy'defaultAssignee'targetEntityChecklistTask::class)]
  182.     private Collection $checklistTasksAsAssignee;
  183.     #[ORM\OneToMany(mappedBy'verifier'targetEntityChecklistTask::class)]
  184.     private Collection $checklistTaskAsVerifier;
  185.     #[ORM\OneToMany(mappedBy'defaultAssignee'targetEntityChecklist::class)]
  186.     private Collection $checklistsAsAssignee;
  187.     #[ORM\OneToMany(mappedBy'owner'targetEntityChecklist::class)]
  188.     private Collection $checklistsAsOwner;
  189.     #[ORM\OneToMany(mappedBy'onboardUser'targetEntityChecklist::class)]
  190.     private Collection $onboardedChecklists;
  191.     #[ORM\OneToMany(mappedBy'user'targetEntityChecklistActivity::class)]
  192.     private Collection $checklistActivities;
  193.     #[ORM\OneToMany(mappedBy'userId'targetEntityChatbotThreads::class, orphanRemovaltrue)]
  194.     private Collection $chatbotThreads;
  195.     #[ORM\OneToMany(mappedBy'createdBy'targetEntityChatbotSection::class, orphanRemovaltrue)]
  196.     private Collection $chatbotSections;
  197.     #[ORM\OneToMany(mappedBy'createdBy'targetEntityChatbotPrompt::class)]
  198.     private Collection $chatbotPrompts;
  199.     #[ORM\OneToMany(mappedBy'createdBy'targetEntityChatbotCompanyPrompt::class, orphanRemovaltrue)]
  200.     private Collection $chatbotCompanyPrompts;
  201.     #[ORM\OneToMany(mappedBy'updatedBy'targetEntityChatbotFaq::class)]
  202.     private Collection $chatbotFaqs;
  203.     #[ORM\OneToMany(mappedBy'createdBy'targetEntityProjectDynamicField::class, orphanRemovaltrue)]
  204.     private Collection $projectDynamicFields;
  205.     #[ORM\OneToMany(mappedBy'user'targetEntityXeroUser::class)]
  206.     private Collection $xeroUsers;
  207.     public function __construct()
  208.     {
  209.         // $this->offices = new ArrayCollection();
  210.         $this->company = new ArrayCollection();
  211.         $this->invitations = new ArrayCollection();
  212.         $this->documents = new ArrayCollection();
  213.         $this->organizations = new ArrayCollection();
  214.         $this->objectives = new ArrayCollection();
  215.         $this->appraisals = new ArrayCollection();
  216.         $this->logs = new ArrayCollection();
  217.         $this->subordinate = new ArrayCollection();
  218.         $this->notifications = new ArrayCollection();
  219.         $this->certifications = new ArrayCollection();
  220.         $this->flexiWorkArrangementRequest = new ArrayCollection();
  221.         $this->subManager = new ArrayCollection();
  222.         $this->jobs = new ArrayCollection();
  223.         $this->appraisalQuestionnaires = new ArrayCollection();
  224.         $this->leaveEntitlements = new ArrayCollection();
  225.         $this->leaveRequests = new ArrayCollection();
  226.         $this->leaveMCRecords = new ArrayCollection();
  227.         $this->timeSpents = new ArrayCollection();
  228.         $this->tasks = new ArrayCollection();
  229.         $this->projects = new ArrayCollection();
  230.         $this->purchaseOrders = new ArrayCollection();
  231.         $this->projectsUserIsPIC = new ArrayCollection();
  232.         $this->vendorQuotations = new ArrayCollection();
  233.         $this->salaries = new ArrayCollection();
  234.         $this->projectMembers = new ArrayCollection();
  235.         $this->userTitles = new ArrayCollection();
  236.         $this->assetUsages = new ArrayCollection();
  237.         $this->courseUserEnrollments = new ArrayCollection();
  238.         $this->expenseRequests = new ArrayCollection();
  239.         $this->recruitApplicationComments = new ArrayCollection();
  240.         $this->recruitApplicationWithdrawComments = new ArrayCollection();
  241.         $this->recruitVacancies = new ArrayCollection();
  242.         $this->recruitVacancyHiringmanagers = new ArrayCollection();
  243.         $this->recruitVacancyApprovers = new ArrayCollection();
  244.         $this->recruitApplicationActivities = new ArrayCollection();
  245.         $this->recruitApplicationCommentsMultiple = new ArrayCollection();
  246.         $this->recruitQuestions = new ArrayCollection();
  247.         $this->recruitEvaluationScores = new ArrayCollection();
  248.         $this->recruitApplications = new ArrayCollection();
  249.         $this->defaultApprovers = new ArrayCollection();
  250.         $this->recruitVacancyHistories = new ArrayCollection();
  251.         $this->recruitSettingActivities = new ArrayCollection();
  252.         $this->recruitTalentSearchSessions = new ArrayCollection();
  253.         $this->applicationsAsInterviewer = new ArrayCollection();
  254.         $this->hrInterviewer = new ArrayCollection();
  255.         $this->workingFromAbroads = new ArrayCollection();
  256.         $this->checklistTasksAsAssignee = new ArrayCollection();
  257.         $this->checklistTaskAsVerifier = new ArrayCollection();
  258.         $this->checklistsAsAssignee = new ArrayCollection();
  259.         $this->checklistsAsOwner = new ArrayCollection();
  260.         $this->onboardedChecklists = new ArrayCollection();
  261.         $this->checklistActivities = new ArrayCollection();
  262.         $this->chatbotThreads = new ArrayCollection();
  263.         $this->chatbotSections = new ArrayCollection();
  264.         $this->chatbotPrompts = new ArrayCollection();
  265.         $this->chatbotCompanyPrompts = new ArrayCollection();
  266.         $this->chatbotFaqs = new ArrayCollection();
  267.         $this->projectDynamicFields = new ArrayCollection();
  268.         $this->xeroUsers = new ArrayCollection();
  269.     }
  270.     public function getSalt(): ?string
  271.     {
  272.         return null;
  273.     }
  274.     public function eraseCredentials(): void {}
  275.     public function getUserIdentifier(): string
  276.     {
  277.         return $this->email;
  278.     }
  279.     public function getId(): ?int
  280.     {
  281.         return $this->id;
  282.     }
  283.     public function getEmail(): ?string
  284.     {
  285.         return $this->email;
  286.     }
  287.     public function setEmail(string $email): self
  288.     {
  289.         $this->email $email;
  290.         return $this;
  291.     }
  292.     /**
  293.      * @return mixed
  294.      */
  295.     public function getCanonicalEmail()
  296.     {
  297.         return $this->canonicalEmail;
  298.     }
  299.     /**
  300.      * @param mixed $canonicalEmail
  301.      */
  302.     public function setCanonicalEmail($canonicalEmail): void
  303.     {
  304.         $this->canonicalEmail $canonicalEmail;
  305.     }
  306.     public function getEmailValidated(): ?bool
  307.     {
  308.         return $this->emailValidated;
  309.     }
  310.     public function setEmailValidated(?bool $emailValidated): self
  311.     {
  312.         $this->emailValidated $emailValidated;
  313.         return $this;
  314.     }
  315.     public function getUsername(): string
  316.     {
  317.         return $this->email;
  318.     }
  319.     public function getNameAndSurname()
  320.     {
  321.         return $this->personalInfo->getFirstName() . ' ' $this->personalInfo->getLastName();
  322.     }
  323.     public function getNickname()
  324.     {
  325.         $email $this->getCanonicalEmail();
  326.         $parts explode('@'$email);
  327.         $namePart $parts[0];
  328.         $nameParts explode('.'$namePart);
  329.         $result ucfirst($nameParts[0]);
  330.         return $result;
  331.         // $capitalizedParts = array_map('ucfirst', $nameParts);
  332.         // $result = implode(' ', $capitalizedParts);
  333.     }
  334.     public function getPassword(): ?string
  335.     {
  336.         return $this->password;
  337.     }
  338.     public function setPassword(string $password): self
  339.     {
  340.         $this->password $password;
  341.         return $this;
  342.     }
  343.     /**
  344.      * @return mixed
  345.      */
  346.     public function getPlainPassword()
  347.     {
  348.         return $this->plainPassword;
  349.     }
  350.     /**
  351.      * @param mixed $plainPassword
  352.      */
  353.     public function setPlainPassword($plainPassword): void
  354.     {
  355.         $this->plainPassword $plainPassword;
  356.     }
  357.     public function getIsActive(): ?bool
  358.     {
  359.         return $this->isActive;
  360.     }
  361.     public function setIsActive(bool $isActive): self
  362.     {
  363.         $this->isActive $isActive;
  364.         return $this;
  365.     }
  366.     public function getRoles(): array
  367.     {
  368.         $roles $this->roles;
  369.         $roles[] = 'ROLE_STAFF';
  370.         return array_unique($roles);
  371.     }
  372.     public function setRoles(array $roles): self
  373.     {
  374.         $this->roles $roles;
  375.         return $this;
  376.     }
  377.     public function addRole($role): self
  378.     {
  379.         $roles $this->roles;
  380.         array_push($roles$role);
  381.         $this->roles array_unique($roles);
  382.         return $this;
  383.     }
  384.     public function hasRole($role): bool
  385.     {
  386.         return in_array($role$this->roles);
  387.     }
  388.     public function removeRole($role): self
  389.     {
  390.         $roles $this->roles;
  391.         if (($key array_search($role$roles)) !== false) {
  392.             unset($roles[$key]);
  393.         }
  394.         $this->roles array_unique($roles);
  395.         return $this;
  396.     }
  397.     public function getPublicRoles(): ?string
  398.     {
  399.         if (in_array('ROLE_OWNER'$this->roles)) {
  400.             return 'roles.owner';
  401.         } elseif (in_array('ROLE_MANAGEMENT'$this->roles)) {
  402.             return 'roles.management';
  403.         } elseif (in_array('ROLE_HR'$this->roles)) {
  404.             return 'roles.hr';
  405.         } elseif (in_array('ROLE_TEAM_LEADER'$this->roles)) {
  406.             return 'roles.leader';
  407.         } elseif (in_array('ROLE_FINANCE'$this->roles)) {
  408.             return 'roles.finance';
  409.         } elseif (in_array('ROLE_MARCOM'$this->roles)) {
  410.             return 'roles.marcom';
  411.         } else {
  412.             return 'roles.user';
  413.         }
  414.     }
  415.     public function setPublicRoles($publicRole$allOffice false): ?self
  416.     {
  417.         /*
  418.             # Main Roles
  419.             ROLE_STAFF
  420.             ROLE_ACCOUNT
  421.             ROLE_FINANCE
  422.             ROLE_MARCOM
  423.             ROLE_HR
  424.             ROLE_MANAGEMENT
  425.             
  426.             # Sub Roles
  427.             ROLE_ACCESS_ALL_OFFICE
  428.         */
  429.         $roles = [];
  430.         switch ($publicRole) {
  431.             case 'roles.owner':
  432.                 array_push($roles'ROLE_OWNER');
  433.                 break;
  434.             case 'roles.management':
  435.                 array_push($roles'ROLE_MANAGEMENT');
  436.                 break;
  437.             case 'roles.hr':
  438.                 array_push($roles'ROLE_HR');
  439.                 break;
  440.             case 'roles.leader':
  441.                 array_push($roles'ROLE_TEAM_LEADER');
  442.                 break;
  443.             case 'roles.finance':
  444.                 array_push($roles'ROLE_FINANCE');
  445.                 break;
  446.             case 'roles.marcom':
  447.                 array_push($roles'ROLE_MARCOM');
  448.                 break;
  449.             default:
  450.                 array_push($roles'ROLE_STAFF');
  451.                 break;
  452.         }
  453.         if (!in_array('ROLE_MANAGEMENT'$roles) && $allOffice == true || in_array('ROLE_ACCESS_ALL_OFFICE'$roles)) {
  454.             array_push($roles'ROLE_ACCESS_ALL_OFFICE');
  455.         };
  456.         $this->roles $roles;
  457.         return $this;
  458.     }
  459.     public function getAllOfficeAccess()
  460.     {
  461.         $rolesToCheck = ['ROLE_ACCESS_ALL_OFFICE''ROLE_MANAGEMENT''ROLE_OWNER'];
  462.         foreach ($rolesToCheck as $role) {
  463.             if (in_array($role$this->roles)) {
  464.                 return true;
  465.             }
  466.         }
  467.         return false;
  468.     }
  469.     public function getConfirmationToken(): ?string
  470.     {
  471.         return $this->confirmationToken;
  472.     }
  473.     public function setConfirmationToken(?string $confirmationToken): self
  474.     {
  475.         $this->confirmationToken $confirmationToken;
  476.         return $this;
  477.     }
  478.     /**
  479.      * @return mixed
  480.      */
  481.     public function getForgetToken()
  482.     {
  483.         return $this->forgetToken;
  484.     }
  485.     /**
  486.      * @param mixed $forgetToken
  487.      */
  488.     public function setForgetToken($forgetToken): void
  489.     {
  490.         $this->forgetToken $forgetToken;
  491.     }
  492.     public function getCreatedAt(): ?\DateTimeInterface
  493.     {
  494.         return $this->createdAt;
  495.     }
  496.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  497.     {
  498.         $this->createdAt $createdAt;
  499.         return $this;
  500.     }
  501.     public function getLastActivityAt(): ?\DateTimeInterface
  502.     {
  503.         return $this->lastActivityAt;
  504.     }
  505.     public function setLastActivityAt(?\DateTimeInterface $lastActivityAt): self
  506.     {
  507.         $this->lastActivityAt $lastActivityAt;
  508.         return $this;
  509.     }
  510.     public function getPersonalInfo(): ?PersonalInfo
  511.     {
  512.         return $this->personalInfo;
  513.     }
  514.     public function setPersonalInfo(PersonalInfo $personalInfo): self
  515.     {
  516.         $this->personalInfo $personalInfo;
  517.         // set the owning side of the relation if necessary
  518.         if ($personalInfo->getUser() !== $this) {
  519.             $personalInfo->setUser($this);
  520.         }
  521.         return $this;
  522.     }
  523.     public function getOffice(): ?Office
  524.     {
  525.         return $this->office;
  526.     }
  527.     public function setOffice(?Office $office): self
  528.     {
  529.         $this->office $office;
  530.         return $this;
  531.     }
  532.     /**
  533.      * @return Collection|Company[]
  534.      */
  535.     public function getCompany(): Collection
  536.     {
  537.         return $this->company;
  538.     }
  539.     public function addCompany(Company $company): self
  540.     {
  541.         if (!$this->company->contains($company)) {
  542.             $this->company[] = $company;
  543.             $company->setUser($this);
  544.         }
  545.         return $this;
  546.     }
  547.     public function removeCompany(Company $company): self
  548.     {
  549.         if ($this->company->contains($company)) {
  550.             $this->company->removeElement($company);
  551.             // set the owning side to null (unless already changed)
  552.             if ($company->getUser() === $this) {
  553.                 $company->setUser(null);
  554.             }
  555.         }
  556.         return $this;
  557.     }
  558.     public function getLastLoginAt(): ?\DateTimeInterface
  559.     {
  560.         return $this->lastLoginAt;
  561.     }
  562.     public function setLastLoginAt(?\DateTimeInterface $lastLoginAt): self
  563.     {
  564.         $this->lastLoginAt $lastLoginAt;
  565.         return $this;
  566.     }
  567.     public function companyOwner($companyNumber 0)
  568.     {
  569.         if ($this->company[$companyNumber] != null && $this->company[$companyNumber]->getUser() == $this) {
  570.             return true;
  571.         } else {
  572.             return false;
  573.         }
  574.     }
  575.     public function assignedOffices($companyNumber 0$forceAccessAll false)
  576.     {
  577.         if ($this->companyOwner()) {
  578.             return $this->company[$companyNumber]->getOffices();
  579.         } else if (in_array('ROLE_ACCESS_ALL_OFFICE'$this->roles) || $forceAccessAll) {
  580.             return  $this->assignedCompany($companyNumber)->getOffices();
  581.         } else {
  582.             return [$this->office];
  583.         }
  584.     }
  585.     public function assignedCompany($companyNumber 0)
  586.     {
  587.         if ($this->companyOwner()) {
  588.             return $this->company[$companyNumber];
  589.         } else {
  590.             return $this->office->getCompany();
  591.         }
  592.     }
  593.     /**
  594.      * @return Collection|Invitation[]
  595.      */
  596.     public function getInvitations(): Collection
  597.     {
  598.         return $this->invitations;
  599.     }
  600.     public function addInvitation(Invitation $invitation): self
  601.     {
  602.         if (!$this->invitations->contains($invitation)) {
  603.             $this->invitations[] = $invitation;
  604.             $invitation->setInviter($this);
  605.         }
  606.         return $this;
  607.     }
  608.     public function removeInvitation(Invitation $invitation): self
  609.     {
  610.         if ($this->invitations->contains($invitation)) {
  611.             $this->invitations->removeElement($invitation);
  612.             // set the owning side to null (unless already changed)
  613.             if ($invitation->getInviter() === $this) {
  614.                 $invitation->setInviter(null);
  615.             }
  616.         }
  617.         return $this;
  618.     }
  619.     /**
  620.      * @return Collection|Document[]
  621.      */
  622.     public function getDocuments(): Collection
  623.     {
  624.         return $this->documents;
  625.     }
  626.     public function addDocument(Document $document): self
  627.     {
  628.         if (!$this->documents->contains($document)) {
  629.             $this->documents[] = $document;
  630.             $document->setUser($this);
  631.         }
  632.         return $this;
  633.     }
  634.     public function removeDocument(Document $document): self
  635.     {
  636.         if ($this->documents->contains($document)) {
  637.             $this->documents->removeElement($document);
  638.             // set the owning side to null (unless already changed)
  639.             if ($document->getUser() === $this) {
  640.                 $document->setUser(null);
  641.             }
  642.         }
  643.         return $this;
  644.     }
  645.     /**
  646.      * @return Collection|Organization[]
  647.      */
  648.     public function getOrganizations(): Collection
  649.     {
  650.         return $this->organizations;
  651.     }
  652.     public function addOrganization(Organization $organization): self
  653.     {
  654.         if (!$this->organizations->contains($organization)) {
  655.             $this->organizations[] = $organization;
  656.             $organization->setUser($this);
  657.         }
  658.         return $this;
  659.     }
  660.     public function removeOrganization(Organization $organization): self
  661.     {
  662.         if ($this->organizations->contains($organization)) {
  663.             $this->organizations->removeElement($organization);
  664.             // set the owning side to null (unless already changed)
  665.             if ($organization->getUser() === $this) {
  666.                 $organization->setUser(null);
  667.             }
  668.         }
  669.         return $this;
  670.     }
  671.     function organizationTitles()
  672.     {
  673.         if ($this->personalInfo->getJobTitle()) {
  674.             return $this->personalInfo->getJobTitle();
  675.         } else { // For transitioning
  676.             $titles = [];
  677.             foreach ($this->getOrganizations() as $organization) {
  678.                 if (!in_array($organization->getTitle(), $titles))
  679.                     array_push($titles$organization->getTitle());
  680.             }
  681.             return implode(', '$titles);
  682.         };
  683.     }
  684.     function organizationDepartments()
  685.     {
  686.         if ($this->department) {
  687.             return $this->department;
  688.         } else { // For transitioning
  689.             $departments = [];
  690.             foreach ($this->getOrganizations() as $organization) {
  691.                 if (in_array($organization->getDepartment(), $departments) == false)
  692.                     array_push($departments$organization->getDepartment());
  693.             }
  694.             return $departments;
  695.         }
  696.     }
  697.     function organizationDepartmentNames()
  698.     {
  699.         if ($this->department) {
  700.             return $this->department->getName();
  701.         } else { // For transitioning
  702.             $departments = [];
  703.             foreach ($this->getOrganizations() as $organization) {
  704.                 if (in_array($organization->getDepartment()->getName(), $departments) == false)
  705.                     array_push($departments$organization->getDepartment()->getName());
  706.             }
  707.             return implode(', '$departments);
  708.         };
  709.     }
  710.     function organizationDepartmentIds()
  711.     {
  712.         $departments = [];
  713.         foreach ($this->getOrganizations() as $organization) {
  714.             if (in_array($organization->getDepartment()->getId(), $departments) == false)
  715.                 array_push($departments$organization->getDepartment()->getId());
  716.         }
  717.         return $departments;
  718.     }
  719.     function organizationSupervisor()
  720.     {
  721.         $superior = [];
  722.         $registered_superior = [];
  723.         foreach ($this->getOrganizations() as $organization) {
  724.             if (method_exists($organization->getSupervisor(), 'getIsGroup') && $organization->getSupervisor()->getIsGroup()) {
  725.                 foreach ($organization->getSupervisor()->getGroupUsers() as $gu) {
  726.                     if (in_array($gu->getUser()->getId(), $registered_superior) == false) {
  727.                         array_push($superior$gu->getUser());
  728.                         array_push($registered_superior$gu->getUser()->getId());
  729.                     }
  730.                 }
  731.             } else {
  732.                 if (method_exists($organization->getSupervisor(), 'getUser') && in_array($organization->getSupervisor()->getUser()->getId(), $registered_superior) == false) {
  733.                     array_push($superior$organization->getSupervisor()->getUser());
  734.                     array_push($registered_superior,  $organization->getSupervisor()->getUser()->getId());
  735.                 }
  736.             };
  737.         };
  738.         return $superior;
  739.     }
  740.     function isSubordinate($uid)
  741.     {
  742.         // this code is ugly, need to refactor
  743.         foreach ($this->getOrganizations() as $organization) {
  744.             foreach ($organization->getSupervisorChilds() as $child) {
  745.                 if ($child->getUser() != null && $child->getUser()->getId() == $uid) return true;
  746.                 if ($child->getSupervisorChilds()) {
  747.                     foreach ($child->getSupervisorChilds() as $child2) {
  748.                         if ($child2->getUser()->getId() == $uid)
  749.                             return true;
  750.                         if ($child2->getSupervisorChilds()) {
  751.                             foreach ($child2->getSupervisorChilds() as $child3) {
  752.                                 if ($child3->getUser()->getId() == $uid)
  753.                                     return true;
  754.                                 if ($child3->getSupervisorChilds()) {
  755.                                     foreach ($child3->getSupervisorChilds() as $child4) {
  756.                                         if ($child4->getUser()->getId() == $uid)
  757.                                             return true;
  758.                                         if ($child4->getSupervisorChilds()) {
  759.                                             foreach ($child4->getSupervisorChilds() as $child5) {
  760.                                                 if ($child5->getUser()->getId() == $uid)
  761.                                                     return true;
  762.                                             }
  763.                                         }
  764.                                     }
  765.                                 }
  766.                             }
  767.                         }
  768.                     }
  769.                 }
  770.             }
  771.         };
  772.         return false;
  773.     }
  774.     /**
  775.      * @return Collection|Objective[]
  776.      */
  777.     public function getObjectives(): Collection
  778.     {
  779.         return $this->objectives;
  780.     }
  781.     public function addObjective(Objective $objective): self
  782.     {
  783.         if (!$this->objectives->contains($objective)) {
  784.             $this->objectives[] = $objective;
  785.             $objective->setUser($this);
  786.         }
  787.         return $this;
  788.     }
  789.     public function removeObjective(Objective $objective): self
  790.     {
  791.         if ($this->objectives->contains($objective)) {
  792.             $this->objectives->removeElement($objective);
  793.             // set the owning side to null (unless already changed)
  794.             if ($objective->getUser() === $this) {
  795.                 $objective->setUser(null);
  796.             }
  797.         }
  798.         return $this;
  799.     }
  800.     public function totalObjective()
  801.     {
  802.         return count($this->objectives);
  803.     }
  804.     public function totalActiveObjective()
  805.     {
  806.         // $total = 0;
  807.         // foreach ($this->objectives as $objective) {
  808.         //     if ($objective->getDeadlineAt()->format('Ymd') >= date('Ymd')) {
  809.         //         $total++;
  810.         //     };
  811.         // };
  812.         // return $total;
  813.         // if($this->personalInfo->getJobExpiryDate() != null && $this->personalInfo->getJobExpiryDate()->format('Ymd') >= date('Ymd')){
  814.         //     return count($this->objectives);
  815.         // } else {
  816.         //     return 0;
  817.         // }
  818.         $total 0;
  819.         foreach ($this->objectives as $objective) {
  820.             if ($objective->getAppraisalYear() == null) {
  821.                 $total++;
  822.             };
  823.         };
  824.         return $total;
  825.     }
  826.     public function totalDueObjective()
  827.     {
  828.         $total 0;
  829.         foreach ($this->objectives as $objective) {
  830.             if ($objective->getAppraisalYear() == date('Y')) {
  831.                 $total++;
  832.             };
  833.         };
  834.         return $total;
  835.         // if($this->personalInfo->getJobExpiryDate() != null && $this->personalInfo->getJobExpiryDate()->format('Ymd') < date('Ymd')){
  836.         //     return count($this->objectives);
  837.         // } else {
  838.         //     return 0;
  839.         // }
  840.     }
  841.     public function allObjectiveExpired()
  842.     {
  843.         if ($this->totalObjective() == $this->totalDueObjective()) {
  844.             return true;
  845.         } else {
  846.             return false;
  847.         }
  848.     }
  849.     /**
  850.      * @return Collection|Appraisal[]
  851.      */
  852.     public function getAppraisals(): Collection
  853.     {
  854.         return $this->appraisals;
  855.     }
  856.     public function addAppraisal(Appraisal $appraisal): self
  857.     {
  858.         if (!$this->appraisals->contains($appraisal)) {
  859.             $this->appraisals[] = $appraisal;
  860.             $appraisal->setUser($this);
  861.         }
  862.         return $this;
  863.     }
  864.     public function removeAppraisal(Appraisal $appraisal): self
  865.     {
  866.         if ($this->appraisals->contains($appraisal)) {
  867.             $this->appraisals->removeElement($appraisal);
  868.             // set the owning side to null (unless already changed)
  869.             if ($appraisal->getUser() === $this) {
  870.                 $appraisal->setUser(null);
  871.             }
  872.         }
  873.         return $this;
  874.     }
  875.     public function activeAppraisals()
  876.     {
  877.         $activeAppraisals = [];
  878.         foreach ($this->appraisals as $appraisal) {
  879.             // Old rule
  880.             // if ($appraisal->currentStep() > 0 && $appraisal->currentStep() <= 5 && !$appraisal->getAdHoc()) {
  881.             //     array_push($activeAppraisals, $appraisal);
  882.             // };
  883.             if ($appraisal->getCreatedAt()->format('Ymd') >= '20220920' && $appraisal->currentStep() > && $appraisal->currentStep() <= && !$appraisal->getAdHoc()) {
  884.                 array_push($activeAppraisals$appraisal);
  885.             }
  886.         };
  887.         return $activeAppraisals;
  888.     }
  889.     public function submittedAppraisals()
  890.     {
  891.         $submittedAppraisals = [];
  892.         foreach ($this->appraisals as $appraisal) {
  893.             if ($appraisal->getSubmittedAt() != null) {
  894.                 array_push($submittedAppraisals$appraisal);
  895.             };
  896.         };
  897.         return $submittedAppraisals;
  898.     }
  899.     public function reviewedAppraisals()
  900.     {
  901.         $reviewedAppraisals = [];
  902.         foreach ($this->appraisals as $appraisal) {
  903.             //if ($appraisal->getReviewedAt() != null) {
  904.             if (date('Ymd') <= $appraisal->getSubmitAt()->format('Ymd')) {
  905.                 array_push($reviewedAppraisals$appraisal);
  906.             };
  907.         };
  908.         return $reviewedAppraisals;
  909.     }
  910.     public function pendingAppraisals()
  911.     {
  912.         $pendingAppraisals = [];
  913.         foreach ($this->appraisals as $appraisal) {
  914.             if ($appraisal->getSubmittedAt() != null) {
  915.                 array_push($pendingAppraisals$appraisal);
  916.             } else if (date('Ymd') > $appraisal->getSubmitAt()->format('Ymd') && $appraisal->getSubmittedAt() == null) {
  917.                 array_push($pendingAppraisals$appraisal);
  918.             };
  919.         };
  920.         return $pendingAppraisals;
  921.     }
  922.     public function latestAppraisal($compareObject null)
  923.     {
  924.         $latestDate null;
  925.         $latestAppraisal null;
  926.         if (count($this->appraisals) > 0) {
  927.             foreach ($this->appraisals as $appraisal) {
  928.                 if ($appraisal->getCreatedAt()->format('Ymd') > $latestDate) {
  929.                     $latestDate $appraisal->getCreatedAt()->format('Ymd');
  930.                     $latestAppraisal $appraisal;
  931.                 };
  932.             };
  933.         };
  934.         if ($compareObject) {
  935.             return $compareObject == $latestAppraisal;
  936.         } else {
  937.             return $latestAppraisal;
  938.         };
  939.     }
  940.     public function probationAppraisal()
  941.     {
  942.         foreach ($this->appraisals as $appraisal) {
  943.             if ($appraisal->getCreatedAt()->format('Ymd') >= '20220920' && $appraisal->getProbation()) {
  944.                 return $appraisal;
  945.             }
  946.         };
  947.     }
  948.     public function appraisalDetail($step null)
  949.     {
  950.         $activeAppraisals $this->activeAppraisals();
  951.         if ($activeAppraisals) {
  952.             switch ($step) {
  953.                 case '1':
  954.                     if ($activeAppraisals[0]->getSubmitAt()->format('Ymd') < date('Ymd')) {
  955.                         return ['step' => '1''missed' => true'text' => 'form.appraisal.missed.title'];
  956.                     } else {
  957.                         return ['step' => '1''missed' => false'text' => 'form.appraisal.pending.user_default'];
  958.                     }
  959.                     break;
  960.                 case '2':
  961.                     return ['step' => '2''missed' => false'text' => 'form.appraisal.pending.manager'];
  962.                     break;
  963.                 case '3':
  964.                     return ['step' => '3''missed' => false'text' => 'form.appraisal.pending.review'];
  965.                     break;
  966.                 case '4':
  967.                     return ['step' => '4''missed' => false'text' => 'form.appraisal.ready'];
  968.                     break;
  969.                 case '5':
  970.                     return ['step' => '5''missed' => false'text' => 'form.appraisal.pending.conclusion.manager'];
  971.                     break;
  972.                 default:
  973.                     return ['step' => '6''missed' => false'text' => 'form.appraisal.done'];
  974.                     break;
  975.             }
  976.         } else {
  977.             $jobExpiryDate $this->personalInfo->getJobExpiryDate();
  978.             if ($jobExpiryDate) {
  979.                 return ['step' => '0''missed' => false'text' => $jobExpiryDate->format('Ymd') < date('Ymd') ? 'overdue/invalid' 'scheduled'];
  980.             } else {
  981.                 return ['step' => '0''missed' => false'text' => 'job expiry date not set'];
  982.             }
  983.         }
  984.     }
  985.     public function appraisalType($appraisal null)
  986.     {
  987.         if ($this->hasRole('ROLE_OWNER')) return null;
  988.         if ($this->inProbation() || ($appraisal != null && $this->probationAppraisal() == $appraisal)) {
  989.             if ($this->getIsManager()) {
  990.                 return 'form.appraisal.type.new_manager';
  991.             } else {
  992.                 return 'form.appraisal.type.new_non_manager';
  993.             }
  994.         } else {
  995.             if ($this->hasRole('ROLE_TEAM_LEADER') || $this->hasRole('ROLE_MANAGEMENT')) {
  996.                 return 'form.appraisal.type.team_leader';
  997.             } elseif ($this->getIsManager()) {
  998.                 return 'form.appraisal.type.manager';
  999.             } else {
  1000.                 return 'form.appraisal.type.non_manager';
  1001.             }
  1002.         }
  1003.     }
  1004.     public function elligibleForAppraisal()
  1005.     {
  1006.         if (in_array($this->personalInfo->getJobStatus(), ['form.job_status.permanent''form.job_status.probation'])) {
  1007.             return true;
  1008.         } else {
  1009.             return false;
  1010.         }
  1011.     }
  1012.     public function getGoogleId(): ?string
  1013.     {
  1014.         return $this->googleId;
  1015.     }
  1016.     public function setGoogleId(?string $googleId): self
  1017.     {
  1018.         $this->googleId $googleId;
  1019.         return $this;
  1020.     }
  1021.     public function getTemporaryPicture(): ?string
  1022.     {
  1023.         return $this->temporaryPicture;
  1024.     }
  1025.     public function setTemporaryPicture(?string $temporaryPicture): self
  1026.     {
  1027.         $this->temporaryPicture $temporaryPicture;
  1028.         return $this;
  1029.     }
  1030.     public function getStatus(): ?string
  1031.     {
  1032.         return $this->status;
  1033.     }
  1034.     public function setStatus(?string $status): self
  1035.     {
  1036.         $this->status $status;
  1037.         return $this;
  1038.     }
  1039.     public function statusLabel()
  1040.     {
  1041.         return $this->status $this->status '.label' false;
  1042.     }
  1043.     public function statusColor()
  1044.     {
  1045.         return $this->status $this->status '.color' false;
  1046.     }
  1047.     /**
  1048.      * @return Collection|Log[]
  1049.      */
  1050.     public function getLogs(): Collection
  1051.     {
  1052.         return $this->logs;
  1053.     }
  1054.     public function addLog(Log $log): self
  1055.     {
  1056.         if (!$this->logs->contains($log)) {
  1057.             $this->logs[] = $log;
  1058.             $log->setOwner($this);
  1059.         }
  1060.         return $this;
  1061.     }
  1062.     public function removeLog(Log $log): self
  1063.     {
  1064.         if ($this->logs->contains($log)) {
  1065.             $this->logs->removeElement($log);
  1066.             // set the owning side to null (unless already changed)
  1067.             if ($log->getOwner() === $this) {
  1068.                 $log->setOwner(null);
  1069.             }
  1070.         }
  1071.         return $this;
  1072.     }
  1073.     public function getManager(): ?self
  1074.     {
  1075.         return $this->manager;
  1076.     }
  1077.     public function setManager(?self $manager): self
  1078.     {
  1079.         $this->manager $manager;
  1080.         return $this;
  1081.     }
  1082.     /**
  1083.      * @return Collection|self[]
  1084.      */
  1085.     public function getSubordinate(): Collection
  1086.     {
  1087.         return $this->subordinate;
  1088.     }
  1089.     public function addSubordinate(self $subordinate): self
  1090.     {
  1091.         if (!$this->subordinate->contains($subordinate)) {
  1092.             $this->subordinate[] = $subordinate;
  1093.             $subordinate->setManager($this);
  1094.         }
  1095.         return $this;
  1096.     }
  1097.     public function removeSubordinate(self $subordinate): self
  1098.     {
  1099.         if ($this->subordinate->contains($subordinate)) {
  1100.             $this->subordinate->removeElement($subordinate);
  1101.             // set the owning side to null (unless already changed)
  1102.             if ($subordinate->getManager() === $this) {
  1103.                 $subordinate->setManager(null);
  1104.             }
  1105.         }
  1106.         return $this;
  1107.     }
  1108.     public function getSubordinates()
  1109.     {
  1110.         $subordinates = [];
  1111.         foreach ($this->assignedCompany()->getAllUser() as $user) {
  1112.             /*if ($user->getManager() != null && $user->getManager()->getId() == $this->id) {
  1113.                 $subordinates[] = $user;
  1114.             }*/
  1115.             foreach ($user->getAllManager() as $manager) {
  1116.                 if ($manager->getId() == $this->id) {
  1117.                     $subordinates[] = $user;
  1118.                 }
  1119.             }
  1120.         }
  1121.         return $subordinates;
  1122.     }
  1123.     /**
  1124.      * @return Collection|Notification[]
  1125.      */
  1126.     public function getNotifications(): Collection
  1127.     {
  1128.         return $this->notifications;
  1129.     }
  1130.     public function addNotification(Notification $notification): self
  1131.     {
  1132.         if (!$this->notifications->contains($notification)) {
  1133.             $this->notifications[] = $notification;
  1134.             $notification->setUser($this);
  1135.         }
  1136.         return $this;
  1137.     }
  1138.     public function removeNotification(Notification $notification): self
  1139.     {
  1140.         if ($this->notifications->contains($notification)) {
  1141.             $this->notifications->removeElement($notification);
  1142.             // set the owning side to null (unless already changed)
  1143.             if ($notification->getUser() === $this) {
  1144.                 $notification->setUser(null);
  1145.             }
  1146.         }
  1147.         return $this;
  1148.     }
  1149.     public function unreadNotifications()
  1150.     {
  1151.         $data = [];
  1152.         foreach ($this->notifications as $notification) {
  1153.             if ($notification->getReadAt() == null)
  1154.                 array_push($data$notification);
  1155.         }
  1156.         return $data;
  1157.     }
  1158.     /**
  1159.      * @return Collection|Certification[]
  1160.      */
  1161.     public function getCertifications(): Collection
  1162.     {
  1163.         return $this->certifications;
  1164.     }
  1165.     public function addCertification(Certification $certification): self
  1166.     {
  1167.         if (!$this->certifications->contains($certification)) {
  1168.             $this->certifications[] = $certification;
  1169.             $certification->setUser($this);
  1170.         }
  1171.         return $this;
  1172.     }
  1173.     public function removeCertification(Certification $certification): self
  1174.     {
  1175.         if ($this->certifications->contains($certification)) {
  1176.             $this->certifications->removeElement($certification);
  1177.             // set the owning side to null (unless already changed)
  1178.             if ($certification->getUser() === $this) {
  1179.                 $certification->setUser(null);
  1180.             }
  1181.         }
  1182.         return $this;
  1183.     }
  1184.     public function activeCertifications()
  1185.     {
  1186.         $activeCertifications = [];
  1187.         foreach ($this->certifications as $certification) {
  1188.             if ($certification->getFilename() != '') {
  1189.                 array_push($activeCertifications$certification);
  1190.             };
  1191.         };
  1192.         return $activeCertifications;
  1193.     }
  1194.     /**
  1195.      * @return Collection|FlexiWorkArrangementRequest[]
  1196.      */
  1197.     public function getFlexiWorkArrangementRequest(): Collection
  1198.     {
  1199.         return $this->flexiWorkArrangementRequest;
  1200.     }
  1201.     public function addFlexiWorkArrangementRequest(FlexiWorkArrangementRequest $flexiWorkArrangementRequest): self
  1202.     {
  1203.         if (!$this->flexiWorkArrangementRequest->contains($flexiWorkArrangementRequest)) {
  1204.             $this->flexiWorkArrangementRequest[] = $flexiWorkArrangementRequest;
  1205.             $flexiWorkArrangementRequest->setUser($this);
  1206.         }
  1207.         return $this;
  1208.     }
  1209.     public function removeFlexiWorkArrangementRequest(FlexiWorkArrangementRequest $flexiWorkArrangementRequest): self
  1210.     {
  1211.         if ($this->flexiWorkArrangementRequest->contains($flexiWorkArrangementRequest)) {
  1212.             $this->flexiWorkArrangementRequest->removeElement($flexiWorkArrangementRequest);
  1213.             // set the owning side to null (unless already changed)
  1214.             if ($flexiWorkArrangementRequest->getUser() === $this) {
  1215.                 $flexiWorkArrangementRequest->setUser(null);
  1216.             }
  1217.         }
  1218.         return $this;
  1219.     }
  1220.     public function requestedFWAProgram()
  1221.     {
  1222.         foreach ($this->flexiWorkArrangementRequest as $FWA) {
  1223.             //if($FWA->getApprovedAt() == null){
  1224.             return $FWA->getTitle();
  1225.             //}
  1226.         }
  1227.         return null;
  1228.     }
  1229.     public function activeFWAProgram()
  1230.     {
  1231.         foreach ($this->flexiWorkArrangementRequest as $FWA) {
  1232.             if ($FWA->getApprovedAt() != null) {
  1233.                 return $FWA->getTitle();
  1234.             }
  1235.         }
  1236.         return null;
  1237.     }
  1238.     public function pendingFlexiWorkArrangementRequest()
  1239.     {
  1240.         $FWAS = [];
  1241.         foreach ($this->flexiWorkArrangementRequest as $FWA) {
  1242.             if ($FWA->getApprovedAt() == null) {
  1243.                 array_push($FWAS$FWA);
  1244.             }
  1245.         }
  1246.         return $FWAS;
  1247.     }
  1248.     /**
  1249.      * @return Collection|self[]
  1250.      */
  1251.     public function getSubManager(): Collection
  1252.     {
  1253.         return $this->subManager;
  1254.     }
  1255.     public function addSubManager(self $subManager): self
  1256.     {
  1257.         if (!$this->subManager->contains($subManager)) {
  1258.             $this->subManager[] = $subManager;
  1259.         }
  1260.         return $this;
  1261.     }
  1262.     public function removeSubManager(self $subManager): self
  1263.     {
  1264.         $this->subManager->removeElement($subManager);
  1265.         return $this;
  1266.     }
  1267.     public function getSubManagerId()
  1268.     {
  1269.         $subManager = [];
  1270.         foreach ($this->subManager as $sm) {
  1271.             $subManager[$sm->getId()] = $sm->getId();
  1272.         }
  1273.         return $subManager;
  1274.     }
  1275.     public function isIncludedSubManager($user)
  1276.     {
  1277.         foreach ($this->subManager as $sm) {
  1278.             if ($sm == $user && $this->getManager() != $user) return true;
  1279.         }
  1280.         return false;
  1281.     }
  1282.     public function getAllManager($userException null)
  1283.     {
  1284.         $allManager = [];
  1285.         if ($this->manager != $userException && $this->manager->getIsActive()) $allManager[$this->manager->getId()] = $this->manager;
  1286.         foreach ($this->subManager as $sm) {
  1287.             if ($sm != $userException && $sm->getIsActive()) {
  1288.                 $allManager[$sm->getId()] = $sm;
  1289.             };
  1290.         }
  1291.         return $allManager;
  1292.     }
  1293.     public function getIsIncludedManager($user)
  1294.     {
  1295.         $allManager $this->getAllManager();
  1296.         foreach ($allManager as $manager) {
  1297.             if ($manager == $user) {
  1298.                 return true;
  1299.             };
  1300.         }
  1301.         return false;
  1302.     }
  1303.     /**
  1304.      * @return Collection|Job[]
  1305.      */
  1306.     public function getJobs(): Collection
  1307.     {
  1308.         return $this->jobs;
  1309.     }
  1310.     public function addJob(Job $job): self
  1311.     {
  1312.         if (!$this->jobs->contains($job)) {
  1313.             $this->jobs[] = $job;
  1314.             $job->setCreatedBy($this);
  1315.         }
  1316.         return $this;
  1317.     }
  1318.     public function removeJob(Job $job): self
  1319.     {
  1320.         if ($this->jobs->removeElement($job)) {
  1321.             // set the owning side to null (unless already changed)
  1322.             if ($job->getCreatedBy() === $this) {
  1323.                 $job->setCreatedBy(null);
  1324.             }
  1325.         }
  1326.         return $this;
  1327.     }
  1328.     public function getFlexiWorkArrangementOption(): ?FlexiWorkArrangementOption
  1329.     {
  1330.         return $this->flexiWorkArrangementOption;
  1331.     }
  1332.     public function setFlexiWorkArrangementOption(?FlexiWorkArrangementOption $flexiWorkArrangementOption): self
  1333.     {
  1334.         // unset the owning side of the relation if necessary
  1335.         if ($flexiWorkArrangementOption === null && $this->flexiWorkArrangementOption !== null) {
  1336.             $this->flexiWorkArrangementOption->setUser(null);
  1337.         }
  1338.         // set the owning side of the relation if necessary
  1339.         if ($flexiWorkArrangementOption !== null && $flexiWorkArrangementOption->getUser() !== $this) {
  1340.             $flexiWorkArrangementOption->setUser($this);
  1341.         }
  1342.         $this->flexiWorkArrangementOption $flexiWorkArrangementOption;
  1343.         return $this;
  1344.     }
  1345.     public function getFlexiWorkArrangementOptionList()
  1346.     {
  1347.         $list = [];
  1348.         if (isset($this->flexiWorkArrangementOption)) {
  1349.             if ($this->flexiWorkArrangementOption->getFWH()) {
  1350.                 $list[] = 'page.user.profile.fwa.option.fwh_abbrv';
  1351.                 /*$list[]['full'] = 'page.user.profile.fwa.option.fwh';
  1352.                 $list[]['abbrv'] = 'page.user.profile.fwa.option.fwh_abbrv';*/
  1353.             };
  1354.             if ($this->flexiWorkArrangementOption->getFP()) {
  1355.                 $list[] = 'page.user.profile.fwa.option.fp_abbrv';
  1356.                 /*$list[]['full'] = 'page.user.profile.fwa.option.fp';
  1357.                 $list[]['abbrv'] = 'page.user.profile.fwa.option.fp_abbrv';*/
  1358.             };
  1359.             if ($this->flexiWorkArrangementOption->getPT()) {
  1360.                 $list[] = 'page.user.profile.fwa.option.pt_abbrv';
  1361.                 /*$list[]['full'] = 'page.user.profile.fwa.option.pt';
  1362.                 $list[]['abbrv'] = 'page.user.profile.fwa.option.pt_abbrv';*/
  1363.             };
  1364.         };
  1365.         return $list;
  1366.     }
  1367.     public function getFwaStatus(): ?string
  1368.     {
  1369.         return $this->fwaStatus;
  1370.     }
  1371.     public function setFwaStatus(?string $fwaStatus): self
  1372.     {
  1373.         $this->fwaStatus $fwaStatus;
  1374.         return $this;
  1375.     }
  1376.     public function getReminder(): ?array
  1377.     {
  1378.         return $this->reminder;
  1379.     }
  1380.     public function setReminder(?array $reminder): self
  1381.     {
  1382.         $this->reminder $reminder;
  1383.         return $this;
  1384.     }
  1385.     public function getFeatureDocumentManagement(): ?bool
  1386.     {
  1387.         return $this->featureDocumentManagement;
  1388.     }
  1389.     public function setFeatureDocumentManagement(bool $featureDocumentManagement): self
  1390.     {
  1391.         $this->featureDocumentManagement $featureDocumentManagement;
  1392.         return $this;
  1393.     }
  1394.     public function inProbation()
  1395.     {
  1396.         return $this->personalInfo->getJobStatus() == 'form.job_status.probation' true false;
  1397.     }
  1398.     public function inExtendedProbation()
  1399.     {
  1400.         if ($this->inProbation()) {
  1401.             try {
  1402.                 $join $this->personalInfo->getJobJoinDate();
  1403.                 $end $this->personalInfo->getJobExpiryDate();
  1404.                 if ($end) {
  1405.                     $interval $join->diff($end);
  1406.                     return $interval->format("%m") >= && $interval->format("%d") >= 14 true false;
  1407.                 } else {
  1408.                     return false;
  1409.                 }
  1410.             } catch (Exception $e) {
  1411.                 return false;
  1412.             }
  1413.         } else {
  1414.             return false;
  1415.         }
  1416.     }
  1417.     /**
  1418.      * @return Collection<int, LeaveEntitlement>
  1419.      */
  1420.     public function getLeaveEntitlements(): Collection
  1421.     {
  1422.         return $this->leaveEntitlements;
  1423.     }
  1424.     public function addLeaveEntitlement(LeaveEntitlement $leaveEntitlement): self
  1425.     {
  1426.         if (!$this->leaveEntitlements->contains($leaveEntitlement)) {
  1427.             $this->leaveEntitlements[] = $leaveEntitlement;
  1428.             $leaveEntitlement->setUser($this);
  1429.         }
  1430.         return $this;
  1431.     }
  1432.     public function removeLeaveEntitlement(LeaveEntitlement $leaveEntitlement): self
  1433.     {
  1434.         if ($this->leaveEntitlements->removeElement($leaveEntitlement)) {
  1435.             // set the owning side to null (unless already changed)
  1436.             if ($leaveEntitlement->getUser() === $this) {
  1437.                 $leaveEntitlement->setUser(null);
  1438.             }
  1439.         }
  1440.         return $this;
  1441.     }
  1442.     /**
  1443.      * @return Collection<int, LeaveRequest>
  1444.      */
  1445.     public function getLeaveRequests(): Collection
  1446.     {
  1447.         return $this->leaveRequests;
  1448.     }
  1449.     public function addLeaveRequest(LeaveRequest $leaveRequest): self
  1450.     {
  1451.         if (!$this->leaveRequests->contains($leaveRequest)) {
  1452.             $this->leaveRequests[] = $leaveRequest;
  1453.             $leaveRequest->setUser($this);
  1454.         }
  1455.         return $this;
  1456.     }
  1457.     public function removeLeaveRequest(LeaveRequest $leaveRequest): self
  1458.     {
  1459.         if ($this->leaveRequests->removeElement($leaveRequest)) {
  1460.             // set the owning side to null (unless already changed)
  1461.             if ($leaveRequest->getUser() === $this) {
  1462.                 $leaveRequest->setUser(null);
  1463.             }
  1464.         }
  1465.         return $this;
  1466.     }
  1467.     /**
  1468.      * @return Collection<int, LeaveMCRecord>
  1469.      */
  1470.     public function getLeaveMCRecords(): Collection
  1471.     {
  1472.         return $this->leaveMCRecords;
  1473.     }
  1474.     public function addLeaveMCRecord(LeaveMCRecord $leaveMCRecord): self
  1475.     {
  1476.         if (!$this->leaveMCRecords->contains($leaveMCRecord)) {
  1477.             $this->leaveMCRecords[] = $leaveMCRecord;
  1478.             $leaveMCRecord->setUser($this);
  1479.         }
  1480.         return $this;
  1481.     }
  1482.     public function removeLeaveMCRecord(LeaveMCRecord $leaveMCRecord): self
  1483.     {
  1484.         if ($this->leaveMCRecords->removeElement($leaveMCRecord)) {
  1485.             // set the owning side to null (unless already changed)
  1486.             if ($leaveMCRecord->getUser() === $this) {
  1487.                 $leaveMCRecord->setUser(null);
  1488.             }
  1489.         }
  1490.         return $this;
  1491.     }
  1492.     public function getDepartment(): ?Department
  1493.     {
  1494.         return $this->department;
  1495.     }
  1496.     public function setDepartment(?Department $department): self
  1497.     {
  1498.         $this->department $department;
  1499.         return $this;
  1500.     }
  1501.     /**
  1502.      * @return Collection<int, TimeSpent>
  1503.      */
  1504.     public function getTimeSpents(): Collection
  1505.     {
  1506.         return $this->timeSpents;
  1507.     }
  1508.     public function getTotalTimeSpents($start$end)
  1509.     {
  1510.         $totalHours 0;
  1511.         if ($start && $end) {
  1512.             foreach ($this->timeSpents as $timespent) {
  1513.                 $timeSpentDate $timespent->getDate()->format('Y-m-d');
  1514.                 if ($timeSpentDate >= $start && $timeSpentDate <= $end) {
  1515.                     $totalHours += $timespent->getHours();
  1516.                 }
  1517.             }
  1518.         }
  1519.         return $totalHours;
  1520.     }
  1521.     public function addTimeSpent(TimeSpent $timeSpent): self
  1522.     {
  1523.         if (!$this->timeSpents->contains($timeSpent)) {
  1524.             $this->timeSpents[] = $timeSpent;
  1525.             $timeSpent->setUser($this);
  1526.         }
  1527.         return $this;
  1528.     }
  1529.     public function removeTimeSpent(TimeSpent $timeSpent): self
  1530.     {
  1531.         if ($this->timeSpents->removeElement($timeSpent)) {
  1532.             // set the owning side to null (unless already changed)
  1533.             if ($timeSpent->getUser() === $this) {
  1534.                 $timeSpent->setUser(null);
  1535.             }
  1536.         }
  1537.         return $this;
  1538.     }
  1539.     /**
  1540.      * @return Collection<int, Task>
  1541.      */
  1542.     public function getTasks(): Collection
  1543.     {
  1544.         return $this->tasks;
  1545.     }
  1546.     public function addTask(Task $task): self
  1547.     {
  1548.         if (!$this->tasks->contains($task)) {
  1549.             $this->tasks[] = $task;
  1550.             $task->setUser($this);
  1551.         }
  1552.         return $this;
  1553.     }
  1554.     public function removeTask(Task $task): self
  1555.     {
  1556.         if ($this->tasks->removeElement($task)) {
  1557.             // set the owning side to null (unless already changed)
  1558.             if ($task->getUser() === $this) {
  1559.                 $task->setUser(null);
  1560.             }
  1561.         }
  1562.         return $this;
  1563.     }
  1564.     /**
  1565.      * @return Collection<int, Project>
  1566.      */
  1567.     public function getProjects(): Collection
  1568.     {
  1569.         return $this->projects;
  1570.     }
  1571.     public function addProject(Project $project): self
  1572.     {
  1573.         if (!$this->projects->contains($project)) {
  1574.             $this->projects[] = $project;
  1575.             $project->setCreatedBy($this);
  1576.         }
  1577.         return $this;
  1578.     }
  1579.     public function removeProject(Project $project): self
  1580.     {
  1581.         if ($this->projects->removeElement($project)) {
  1582.             // set the owning side to null (unless already changed)
  1583.             if ($project->getCreatedBy() === $this) {
  1584.                 $project->setCreatedBy(null);
  1585.             }
  1586.         }
  1587.         return $this;
  1588.     }
  1589.     /**
  1590.      * @return Collection<int, PurchaseOrder>
  1591.      */
  1592.     public function getPurchaseOrders(): Collection
  1593.     {
  1594.         return $this->purchaseOrders;
  1595.     }
  1596.     public function addPurchaseOrder(PurchaseOrder $purchaseOrder): self
  1597.     {
  1598.         if (!$this->purchaseOrders->contains($purchaseOrder)) {
  1599.             $this->purchaseOrders[] = $purchaseOrder;
  1600.             $purchaseOrder->setCreatedBy($this);
  1601.         }
  1602.         return $this;
  1603.     }
  1604.     public function removePurchaseOrder(PurchaseOrder $purchaseOrder): self
  1605.     {
  1606.         if ($this->purchaseOrders->removeElement($purchaseOrder)) {
  1607.             // set the owning side to null (unless already changed)
  1608.             if ($purchaseOrder->getCreatedBy() === $this) {
  1609.                 $purchaseOrder->setCreatedBy(null);
  1610.             }
  1611.         }
  1612.         return $this;
  1613.     }
  1614.     public function getJustifiedMCRecords()
  1615.     {
  1616.         $data = [];
  1617.         foreach ($this->leaveRequests as $leaveRequest) {
  1618.             if ($leaveRequest->getLeaveType()->getAttributes()['label'] == 'Sick') {
  1619.                 if ($leaveRequest->getIsApproved()) {
  1620.                     array_push($data$leaveRequest);
  1621.                 }
  1622.             }
  1623.         }
  1624.         return $data;
  1625.     }
  1626.     public function getAllMCRecords()
  1627.     {
  1628.         $data = [];
  1629.         foreach ($this->leaveRequests as $leaveRequest) {
  1630.             if ($leaveRequest->getLeaveType()->getAttributes()['label'] == 'Sick') {
  1631.                 if ($leaveRequest->getIsApproved() == true || is_null($leaveRequest->getIsApproved()) == true) {
  1632.                     array_push($data$leaveRequest);
  1633.                 }
  1634.             }
  1635.         }
  1636.         return $data;
  1637.     }
  1638.     public function getAllLeaveRequests()
  1639.     {
  1640.         $data = [];
  1641.         foreach ($this->leaveRequests as $leaveRequest) {
  1642.             if ($leaveRequest->getLeaveType()->getAttributes()['label'] == 'Annual') {
  1643.                 if ($leaveRequest->getIsApproved() == true || is_null($leaveRequest->getIsApproved()) == true) {
  1644.                     array_push($data$leaveRequest);
  1645.                 }
  1646.             }
  1647.         }
  1648.         return $data;
  1649.     }
  1650.     public function getAllOtherRequests()
  1651.     {
  1652.         $data = [];
  1653.         foreach ($this->leaveRequests as $leaveRequest) {
  1654.             if ($leaveRequest->getLeaveType()->getAttributes()['label'] != 'Sick' && $leaveRequest->getLeaveType()->getAttributes()['label'] != 'Annual') {
  1655.                 if ($leaveRequest->getIsApproved() == true || is_null($leaveRequest->getIsApproved()) == true) {
  1656.                     array_push($data$leaveRequest);
  1657.                 }
  1658.             }
  1659.         }
  1660.         return $data;
  1661.     }
  1662.     public function getApprovedLeaveRequests()
  1663.     {
  1664.         $data = [];
  1665.         foreach ($this->leaveRequests as $leaveRequest) {
  1666.             if ($leaveRequest->getLeaveType()->getAttributes()['label'] == 'Annual') {
  1667.                 if ($leaveRequest->getIsApproved()) {
  1668.                     array_push($data$leaveRequest);
  1669.                 }
  1670.             }
  1671.         }
  1672.         return $data;
  1673.     }
  1674.     /**
  1675.      * @return Collection<int, Project>
  1676.      */
  1677.     public function getProjectsUserIsPIC(): Collection
  1678.     {
  1679.         return $this->projectsUserIsPIC;
  1680.     }
  1681.     public function addProjectsUserIsPIC(Project $projectsUserIsPIC): self
  1682.     {
  1683.         if (!$this->projectsUserIsPIC->contains($projectsUserIsPIC)) {
  1684.             $this->projectsUserIsPIC[] = $projectsUserIsPIC;
  1685.             $projectsUserIsPIC->setPersonInCharge($this);
  1686.         }
  1687.         return $this;
  1688.     }
  1689.     public function removeProjectsUserIsPIC(Project $projectsUserIsPIC): self
  1690.     {
  1691.         if ($this->projectsUserIsPIC->removeElement($projectsUserIsPIC)) {
  1692.             // set the owning side to null (unless already changed)
  1693.             if ($projectsUserIsPIC->getPersonInCharge() === $this) {
  1694.                 $projectsUserIsPIC->setPersonInCharge(null);
  1695.             }
  1696.         }
  1697.         return $this;
  1698.     }
  1699.     /**
  1700.      * @return Collection<int, VendorQuotation>
  1701.      */
  1702.     public function getVendorQuotations(): Collection
  1703.     {
  1704.         return $this->vendorQuotations;
  1705.     }
  1706.     public function addVendorQuotation(VendorQuotation $vendorQuotation): self
  1707.     {
  1708.         if (!$this->vendorQuotations->contains($vendorQuotation)) {
  1709.             $this->vendorQuotations[] = $vendorQuotation;
  1710.             $vendorQuotation->setCreatedBy($this);
  1711.         }
  1712.         return $this;
  1713.     }
  1714.     public function removeVendorQuotation(VendorQuotation $vendorQuotation): self
  1715.     {
  1716.         if ($this->vendorQuotations->removeElement($vendorQuotation)) {
  1717.             // set the owning side to null (unless already changed)
  1718.             if ($vendorQuotation->getCreatedBy() === $this) {
  1719.                 $vendorQuotation->setCreatedBy(null);
  1720.             }
  1721.         }
  1722.         return $this;
  1723.     }
  1724.     public function getJobInfo(): ?JobInfo
  1725.     {
  1726.         return $this->jobInfo;
  1727.     }
  1728.     public function setJobInfo(?JobInfo $jobInfo): self
  1729.     {
  1730.         // unset the owning side of the relation if necessary
  1731.         if ($jobInfo === null && $this->jobInfo !== null) {
  1732.             $this->jobInfo->setUser(null);
  1733.         }
  1734.         // set the owning side of the relation if necessary
  1735.         if ($jobInfo !== null && $jobInfo->getUser() !== $this) {
  1736.             $jobInfo->setUser($this);
  1737.         }
  1738.         $this->jobInfo $jobInfo;
  1739.         return $this;
  1740.     }
  1741.     public function getPermission(): ?array
  1742.     {
  1743.         return $this->permission;
  1744.     }
  1745.     public function setPermission(?array $permission): self
  1746.     {
  1747.         $this->permission $permission;
  1748.         return $this;
  1749.     }
  1750.     /**
  1751.      * @return Collection<int, Salary>
  1752.      */
  1753.     public function getSalaries(): Collection
  1754.     {
  1755.         return $this->salaries;
  1756.     }
  1757.     public function addSalary(Salary $salary): self
  1758.     {
  1759.         if (!$this->salaries->contains($salary)) {
  1760.             $this->salaries[] = $salary;
  1761.             $salary->setUser($this);
  1762.         }
  1763.         return $this;
  1764.     }
  1765.     public function removeSalary(Salary $salary): self
  1766.     {
  1767.         if ($this->salaries->removeElement($salary)) {
  1768.             // set the owning side to null (unless already changed)
  1769.             if ($salary->getUser() === $this) {
  1770.                 $salary->setUser(null);
  1771.             }
  1772.         }
  1773.         return $this;
  1774.     }
  1775.     public function getAllHourlyRates($all false)
  1776.     {
  1777.         $hourlyRates = [];
  1778.         if ($all) {
  1779.             $officeHourlyRates $this->getOffice()->getAllHourlyRates();
  1780.             if (count($officeHourlyRates) > 0) {
  1781.                 $hourlyRates array_merge($hourlyRates$officeHourlyRates);
  1782.             }
  1783.             if ($this->personalInfo->getUserRole()) {
  1784.                 if (count($this->personalInfo->getUserRole()->getDepartmentCosts()) > 0) {
  1785.                     foreach ($this->personalInfo->getUserRole()->getDepartmentCosts() as $deptCost) {
  1786.                         $hourlyRates[] = ['type' => 'role''date' => $deptCost->getValidAt()->format('Y-m-d'), 'rate' => $deptCost->getRate()];
  1787.                     }
  1788.                 }
  1789.             }
  1790.             if (count($this->salaries) > 0) {
  1791.                 foreach ($this->salaries as $salary) {
  1792.                     if ($salary->isAuthentic() == true) continue;
  1793.                     $hourlyRates[] = ['type' => 'salary''date' => $salary->getValidAt()->format('Y-m-d'), 'rate' => $salary->getHourlyRate()];
  1794.                 }
  1795.             }
  1796.             usort($hourlyRates, function ($a$b) {
  1797.                 return $a['date'] <=> $b['date'];
  1798.             });
  1799.         } else {
  1800.             if (count($this->salaries) > 0) {
  1801.                 foreach ($this->salaries as $salary) {
  1802.                     if ($salary->isAuthentic() == true) continue;
  1803.                     $hourlyRates[] = ['type' => 'salary''date' => $salary->getValidAt()->format('Y-m-d'), 'rate' => $salary->getHourlyRate()];
  1804.                 }
  1805.             }
  1806.             usort($hourlyRates, function ($a$b) {
  1807.                 return $a['date'] <=> $b['date'];
  1808.             });
  1809.             if ($this->personalInfo->getUserRole()) {
  1810.                 if (count($this->personalInfo->getUserRole()->getDepartmentCosts()) > 0) {
  1811.                     foreach ($this->personalInfo->getUserRole()->getDepartmentCosts() as $deptCost) {
  1812.                         $hourlyRates[] = ['type' => 'role''date' => $deptCost->getValidAt()->format('Y-m-d'), 'rate' => $deptCost->getRate()];
  1813.                     }
  1814.                 }
  1815.             }
  1816.             usort($hourlyRates, function ($a$b) {
  1817.                 return $a['date'] <=> $b['date'];
  1818.             });
  1819.             $hasSalary false;
  1820.             foreach ($hourlyRates as $key => $hourlyRate) {
  1821.                 if ($hasSalary && $hourlyRate['type'] == 'role') {
  1822.                     unset($hourlyRates[$key]);
  1823.                 }
  1824.                 if (!$hasSalary$hasSalary $hourlyRate['type'] == 'salary';
  1825.             }
  1826.             if ($this->getOffice() == null) return $hourlyRates;
  1827.             $officeHourlyRates $this->getOffice()->getAllHourlyRates();
  1828.             if (count($officeHourlyRates) > 0) {
  1829.                 foreach ($officeHourlyRates as $officeHourlyRate) {
  1830.                     $hourlyRates[] = $officeHourlyRate;
  1831.                 }
  1832.             }
  1833.             usort($hourlyRates, function ($a$b) {
  1834.                 return $a['date'] <=> $b['date'];
  1835.             });
  1836.             $hasOther false;
  1837.             foreach ($hourlyRates as $key => $hourlyRate) {
  1838.                 if ($hasOther && $hourlyRate['type'] == 'office') {
  1839.                     unset($hourlyRates[$key]);
  1840.                 }
  1841.                 if (!$hasOther$hasOther = ($hourlyRate['type'] == 'role' || $hourlyRate['type']) == 'salary';
  1842.             }
  1843.         }
  1844.         foreach ($hourlyRates as $key => $hourlyRate) {
  1845.             $hourlyRates[$key]['date'] = new \DateTime($hourlyRate['date']);
  1846.         }
  1847.         return $hourlyRates;
  1848.     }
  1849.     public function getHourlyRate($date null)
  1850.     {
  1851.         $dateStr $date $date date('Y-m-d');
  1852.         if (count($this->salaries) > 0) {
  1853.             $latestSalary = [];
  1854.             foreach ($this->salaries as $salary) {
  1855.                 if ($salary->isAuthentic() == true) continue;
  1856.                 if ($dateStr >= $salary->getValidAt()->format('Y-m-d'))  array_push($latestSalary$salary);
  1857.             }
  1858.             usort($latestSalary, function ($a$b) {
  1859.                 return $b->getValidAt() <=> $a->getValidAt();
  1860.             });
  1861.             if (isset($latestSalary[0])) {
  1862.                 return  $latestSalary[0]->getHourlyRate();
  1863.             }
  1864.         }
  1865.         // if($this->personalInfo->getUserRole()){
  1866.         //     if(count($this->personalInfo->getUserRole()->getDepartmentCosts()) > 0){
  1867.         //         $latestRates = [];
  1868.         //         foreach($this->personalInfo->getUserRole()->getDepartmentCosts() as $deptCost){
  1869.         //             if($dateStr >= $deptCost->getValidAt()->format('Y-m-d'))  array_push($latestRates, $deptCost);
  1870.         //         }
  1871.         //         usort($latestRates, function ($a, $b) {
  1872.         //             return $b->getValidAt() <=> $a->getValidAt();
  1873.         //         });
  1874.         //         if (isset($latestSalary[0])) {
  1875.         //             return  $latestSalary[0]->getRate();
  1876.         //         }
  1877.         //     }
  1878.         // }
  1879.         $officeHourlyRate $this->getOffice()->getHourlyRate($dateStr) ?? 0;
  1880.         return $officeHourlyRate == null $officeHourlyRate;
  1881.     }
  1882.     public function getHourlyRateUsd($date null$onlySalary false)
  1883.     {
  1884.         // $dateStr = $date ? $date : date('Y-m-d');
  1885.         // if ($this->personalInfo->getUserRole()) {
  1886.         //     if (count($this->personalInfo->getUserRole()->getDepartmentCosts()) > 0) {
  1887.         //         $latestRates = [];
  1888.         //         foreach ($this->personalInfo->getUserRole()->getDepartmentCosts() as $deptCost) {
  1889.         //             if ($dateStr >= $deptCost->getValidAt()->format('Y-m-d'))  array_push($latestRates, $deptCost);
  1890.         //         }
  1891.         //         usort($latestRates, function ($a, $b) {
  1892.         //             return $b->getValidAt() <=> $a->getValidAt();
  1893.         //         });
  1894.         //         return isset($latestRates[0]) ? $latestRates[0]->getRate() : 0;
  1895.         //     }
  1896.         // }
  1897.         // if(count($this->salaries) > 0) {
  1898.         //     foreach($this->salaries as $salary){
  1899.         //         if($salary->isAuthentic() == true) continue;
  1900.         //         if($dateStr >= $salary->getValidAt()->format('Y-m-d')) return $salary->getHourlyRateUsd($dateStr);
  1901.         //     }
  1902.         //     return $salary->getHourlyRateUsd($dateStr);
  1903.         // };
  1904.         // $officeHourlyRate = $this->getOffice()->getHourlyRateUsd($dateStr);
  1905.         // return $officeHourlyRate == null ? 0 : $officeHourlyRate;
  1906.         return $this->getHourlyRate($date$onlySalary);
  1907.     }
  1908.     public function getCostRateUsd($date null)
  1909.     {
  1910.         $dateStr $date $date date('Y-m-d');
  1911.         if (count($this->salaries) > 0) {
  1912.             foreach ($this->salaries as $salary) {
  1913.                 if ($salary->isAuthentic() == true) continue;
  1914.                 if ($dateStr >= $salary->getValidAt()->format('Y-m-d')) return $salary->getHourlyRateUsd($dateStr);
  1915.             }
  1916.             return $salary->getHourlyRateUsd($dateStr);
  1917.         };
  1918.         return 0;
  1919.     }
  1920.     public function getRateCardUsd($date null)
  1921.     {
  1922.         $dateStr $date $date date('Y-m-d');
  1923.         if ($this->personalInfo->getUserRole()) {
  1924.             if (count($this->personalInfo->getUserRole()->getDepartmentCosts()) > 0) {
  1925.                 $latestRates = [];
  1926.                 foreach ($this->personalInfo->getUserRole()->getDepartmentCosts() as $deptCost) {
  1927.                     if ($dateStr >= $deptCost->getValidAt()->format('Y-m-d'))  array_push($latestRates$deptCost);
  1928.                 }
  1929.                 usort($latestRates, function ($a$b) {
  1930.                     return $b->getValidAt() <=> $a->getValidAt();
  1931.                 });
  1932.                 return isset($latestRates[0]) ? $latestRates[0]->getRate() : 0;
  1933.             }
  1934.         }
  1935.         return 0;
  1936.     }
  1937.     public function getSalary(): ?Salary
  1938.     {
  1939.         $latestSalary null;
  1940.         $sortedSalaries = [];
  1941.         foreach ($this->salaries as $salary) {
  1942.             if ($salary->isAuthentic() == false) continue;
  1943.             array_push($sortedSalaries$salary);
  1944.         }
  1945.         // $sortedSalaries = $this->getSalaries()->toArray();
  1946.         usort($sortedSalaries, function (Salary $aSalary $b) {
  1947.             return $b->getValidAt() <=> $a->getValidAt();
  1948.         });
  1949.         if (!empty($sortedSalaries)) {
  1950.             $latestSalary reset($sortedSalaries);
  1951.         }
  1952.         return $latestSalary;
  1953.     }
  1954.     /**
  1955.      * @return Collection<int, ProjectMember>
  1956.      */
  1957.     public function getProjectMembers(): Collection
  1958.     {
  1959.         return $this->projectMembers;
  1960.     }
  1961.     public function addProjectMember(ProjectMember $projectMember): self
  1962.     {
  1963.         if (!$this->projectMembers->contains($projectMember)) {
  1964.             $this->projectMembers[] = $projectMember;
  1965.             $projectMember->setUser($this);
  1966.         }
  1967.         return $this;
  1968.     }
  1969.     public function removeProjectMember(ProjectMember $projectMember): self
  1970.     {
  1971.         if ($this->projectMembers->removeElement($projectMember)) {
  1972.             // set the owning side to null (unless already changed)
  1973.             if ($projectMember->getUser() === $this) {
  1974.                 $projectMember->setUser(null);
  1975.             }
  1976.         }
  1977.         return $this;
  1978.     }
  1979.     /**
  1980.      * @return Collection<int, AppraisalQuestionnaire>
  1981.      */
  1982.     public function getAppraisalQuestionnaires(): Collection
  1983.     {
  1984.         return $this->appraisalQuestionnaires;
  1985.     }
  1986.     public function addAppraisalQuestionnaire(AppraisalQuestionnaire $appraisalQuestionnaire): self
  1987.     {
  1988.         if (!$this->appraisalQuestionnaires->contains($appraisalQuestionnaire)) {
  1989.             $this->appraisalQuestionnaires[] = $appraisalQuestionnaire;
  1990.             $appraisalQuestionnaire->setUser($this);
  1991.         }
  1992.         return $this;
  1993.     }
  1994.     public function removeAppraisalQuestionnaire(AppraisalQuestionnaire $appraisalQuestionnaire): self
  1995.     {
  1996.         if ($this->appraisalQuestionnaires->removeElement($appraisalQuestionnaire)) {
  1997.             // set the owning side to null (unless already changed)
  1998.             if ($appraisalQuestionnaire->getUser() === $this) {
  1999.                 $appraisalQuestionnaire->setUser(null);
  2000.             }
  2001.         }
  2002.         return $this;
  2003.     }
  2004.     public function getAppraisalStatus(): ?array
  2005.     {
  2006.         return $this->appraisalStatus;
  2007.     }
  2008.     public function setAppraisalStatus(?array $appraisalStatus): self
  2009.     {
  2010.         $this->appraisalStatus $appraisalStatus;
  2011.         return $this;
  2012.     }
  2013.     public function getObjectiveStatus(): ?array
  2014.     {
  2015.         return $this->objectiveStatus;
  2016.     }
  2017.     public function setObjectiveStatus(?array $objectiveStatus): self
  2018.     {
  2019.         $this->objectiveStatus $objectiveStatus;
  2020.         return $this;
  2021.     }
  2022.     public function getTotalHoursByProject($project)
  2023.     {
  2024.         $totalHours 0;
  2025.         foreach ($this->tasks as $task) {
  2026.             if ($task->getProject()->getName() == $project) {
  2027.                 $totalHours += $task->getWeeklyTotalHours();
  2028.             }
  2029.         }
  2030.         return $totalHours;
  2031.     }
  2032.     /**
  2033.      * @return Collection|UserTitle[]
  2034.      */
  2035.     public function getUserTitles(): Collection
  2036.     {
  2037.         return $this->userTitles;
  2038.     }
  2039.     public function addUserTitle(UserTitle $userTitle): self
  2040.     {
  2041.         if (!$this->userTitles->contains($userTitle)) {
  2042.             $this->userTitles[] = $userTitle;
  2043.             $userTitle->setUser($this);
  2044.         }
  2045.         return $this;
  2046.     }
  2047.     public function removeUserTitle(UserTitle $userTitle): self
  2048.     {
  2049.         if ($this->userTitles->removeElement($userTitle)) {
  2050.             // set the owning side to null (unless already changed)
  2051.             if ($userTitle->getUser() === $this) {
  2052.                 $userTitle->setUser(null);
  2053.             }
  2054.         }
  2055.         return $this;
  2056.     }
  2057.     public function getUserTitle($asArray false)
  2058.     {
  2059.         $latestTitle null;
  2060.         if (count($this->userTitles) == 0) return null;
  2061.         foreach ($this->userTitles as $userTitle) {
  2062.             if ($latestTitle == null$latestTitle $userTitle;
  2063.             if ($latestTitle->getValidAt() < $userTitle->getValidAt() && $userTitle->getValidAt() <= new \DateTimeImmutable()) $latestTitle $userTitle;
  2064.         }
  2065.         return $asArray $latestTitle : ($latestTitle->getTitle() ?? null);
  2066.     }
  2067.     /**
  2068.      * @return Collection|AssetUsage[]
  2069.      */
  2070.     public function getAssetUsages(): Collection
  2071.     {
  2072.         return $this->assetUsages;
  2073.     }
  2074.     public function addAssetUsage(AssetUsage $assetUsage): self
  2075.     {
  2076.         if (!$this->assetUsages->contains($assetUsage)) {
  2077.             $this->assetUsages[] = $assetUsage;
  2078.             $assetUsage->setUser($this);
  2079.         }
  2080.         return $this;
  2081.     }
  2082.     public function removeAssetUsage(AssetUsage $assetUsage): self
  2083.     {
  2084.         if ($this->assetUsages->removeElement($assetUsage)) {
  2085.             // set the owning side to null (unless already changed)
  2086.             if ($assetUsage->getUser() === $this) {
  2087.                 $assetUsage->setUser(null);
  2088.             }
  2089.         }
  2090.         return $this;
  2091.     }
  2092.     /**
  2093.      * @return Collection|CourseUserEnrollment[]
  2094.      */
  2095.     public function getCourseUserEnrollments(): Collection
  2096.     {
  2097.         // return $this->courseUserEnrollments;
  2098.         return $this->courseUserEnrollments->filter(function (CourseUserEnrollment $enrollment) {
  2099.             return !$enrollment->isDeleted();
  2100.         });
  2101.     }
  2102.     public function addCourseUserEnrollment(CourseUserEnrollment $courseUserEnrollment): self
  2103.     {
  2104.         if (!$this->courseUserEnrollments->contains($courseUserEnrollment)) {
  2105.             $this->courseUserEnrollments[] = $courseUserEnrollment;
  2106.             $courseUserEnrollment->setUser($this);
  2107.         }
  2108.         return $this;
  2109.     }
  2110.     public function removeCourseUserEnrollment(CourseUserEnrollment $courseUserEnrollment): self
  2111.     {
  2112.         if ($this->courseUserEnrollments->removeElement($courseUserEnrollment)) {
  2113.             // set the owning side to null (unless already changed)
  2114.             if ($courseUserEnrollment->getUser() === $this) {
  2115.                 $courseUserEnrollment->setUser(null);
  2116.             }
  2117.         }
  2118.         return $this;
  2119.     }
  2120.     public function checkIsManager($includeSub true)
  2121.     {
  2122.         $offices $this->assignedCompany()->getOffices();
  2123.         foreach ($offices as $office) {
  2124.             foreach ($office->getAllUser() as $user) {
  2125.                 if ($user->getManager() != null && $user->getManager()->getId() == $this->id || ($includeSub $user->isIncludedSubManager($this) : '')) {
  2126.                     return true;
  2127.                 }
  2128.             }
  2129.         };
  2130.         return false;
  2131.     }
  2132.     public function getIsManager(): ?bool
  2133.     {
  2134.         return $this->isManager;
  2135.     }
  2136.     public function setIsManager(?bool $isManager): self
  2137.     {
  2138.         $this->isManager $isManager;
  2139.         return $this;
  2140.     }
  2141.     /**
  2142.      * @return Collection<int, ExpenseRequest>
  2143.      */
  2144.     public function getExpenseRequests(): Collection
  2145.     {
  2146.         return $this->expenseRequests;
  2147.     }
  2148.     public function addExpenseRequest(ExpenseRequest $expenseRequest): self
  2149.     {
  2150.         if (!$this->expenseRequests->contains($expenseRequest)) {
  2151.             $this->expenseRequests->add($expenseRequest);
  2152.             $expenseRequest->setRequester($this);
  2153.         }
  2154.         return $this;
  2155.     }
  2156.     /*
  2157.      * @return Collection<int, RecruitApplication>
  2158.      */
  2159.     public function getRecruitApplicationComments(): Collection
  2160.     {
  2161.         return $this->recruitApplicationComments;
  2162.     }
  2163.     public function addRecruitApplicationComment(RecruitApplication $recruitApplicationComment): self
  2164.     {
  2165.         if (!$this->recruitApplicationComments->contains($recruitApplicationComment)) {
  2166.             $this->recruitApplicationComments->add($recruitApplicationComment);
  2167.             $recruitApplicationComment->setCommentRejectedBy($this);
  2168.         }
  2169.         return $this;
  2170.     }
  2171.     public function removeExpenseRequest(ExpenseRequest $expenseRequest): self
  2172.     {
  2173.         if ($this->expenseRequests->removeElement($expenseRequest)) {
  2174.             // set the owning side to null (unless already changed)
  2175.             if ($expenseRequest->getRequester() === $this) {
  2176.                 $expenseRequest->setRequester(null);
  2177.             }
  2178.         }
  2179.         return $this;
  2180.     }
  2181.     public function removeRecruitApplicationComment(RecruitApplication $recruitApplicationComment): self
  2182.     {
  2183.         if ($this->recruitApplicationComments->removeElement($recruitApplicationComment)) {
  2184.             // set the owning side to null (unless already changed)
  2185.             if ($recruitApplicationComment->getCommentRejectedBy() === $this) {
  2186.                 $recruitApplicationComment->setCommentRejectedBy(null);
  2187.             }
  2188.         }
  2189.         return $this;
  2190.     }
  2191.     /**
  2192.      * @return Collection<int, RecruitApplication>
  2193.      */
  2194.     public function getRecruitApplicationWithdrawComments(): Collection
  2195.     {
  2196.         return $this->recruitApplicationWithdrawComments;
  2197.     }
  2198.     public function addRecruitApplicationWithdrawComment(RecruitApplication $recruitApplicationWithdrawComment): self
  2199.     {
  2200.         if (!$this->recruitApplicationWithdrawComments->contains($recruitApplicationWithdrawComment)) {
  2201.             $this->recruitApplicationWithdrawComments->add($recruitApplicationWithdrawComment);
  2202.             $recruitApplicationWithdrawComment->setCommentsWithdrawnBy($this);
  2203.         }
  2204.         return $this;
  2205.     }
  2206.     public function removeRecruitApplicationWithdrawComment(RecruitApplication $recruitApplicationWithdrawComment): self
  2207.     {
  2208.         if ($this->recruitApplicationWithdrawComments->removeElement($recruitApplicationWithdrawComment)) {
  2209.             // set the owning side to null (unless already changed)
  2210.             if ($recruitApplicationWithdrawComment->getCommentsWithdrawnBy() === $this) {
  2211.                 $recruitApplicationWithdrawComment->setCommentsWithdrawnBy(null);
  2212.             }
  2213.         }
  2214.         return $this;
  2215.     }
  2216.     /**
  2217.      * @return Collection<int, RecruitVacancyHiringmanager>
  2218.      */
  2219.     public function getRecruitVacancyHiringmanagers(): Collection
  2220.     {
  2221.         return $this->recruitVacancyHiringmanagers;
  2222.     }
  2223.     public function addRecruitVacancyHiringmanager(RecruitVacancyHiringmanager $recruitVacancyHiringmanager): self
  2224.     {
  2225.         if (!$this->recruitVacancyHiringmanagers->contains($recruitVacancyHiringmanager)) {
  2226.             $this->recruitVacancyHiringmanagers->add($recruitVacancyHiringmanager);
  2227.             $recruitVacancyHiringmanager->setUser($this);
  2228.         }
  2229.         return $this;
  2230.     }
  2231.     public function removeRecruitVacancyHiringmanager(RecruitVacancyHiringmanager $recruitVacancyHiringmanager): self
  2232.     {
  2233.         if ($this->recruitVacancyHiringmanagers->removeElement($recruitVacancyHiringmanager)) {
  2234.             // set the owning side to null (unless already changed)
  2235.             if ($recruitVacancyHiringmanager->getUser() === $this) {
  2236.                 $recruitVacancyHiringmanager->setUser(null);
  2237.             }
  2238.         }
  2239.         return $this;
  2240.     }
  2241.     /**
  2242.      * @return Collection<int, RecruitVacancyApprover>
  2243.      */
  2244.     public function getRecruitVacancyApprovers(): Collection
  2245.     {
  2246.         return $this->recruitVacancyApprovers;
  2247.     }
  2248.     public function addRecruitVacancyApprover(RecruitVacancyApprover $recruitVacancyApprover): self
  2249.     {
  2250.         if (!$this->recruitVacancyApprovers->contains($recruitVacancyApprover)) {
  2251.             $this->recruitVacancyApprovers->add($recruitVacancyApprover);
  2252.             $recruitVacancyApprover->setApprover($this);
  2253.         }
  2254.         return $this;
  2255.     }
  2256.     public function removeRecruitVacancyApprover(RecruitVacancyApprover $recruitVacancyApprover): self
  2257.     {
  2258.         if ($this->recruitVacancyApprovers->removeElement($recruitVacancyApprover)) {
  2259.             // set the owning side to null (unless already changed)
  2260.             if ($recruitVacancyApprover->getApprover() === $this) {
  2261.                 $recruitVacancyApprover->setApprover(null);
  2262.             }
  2263.         }
  2264.         return $this;
  2265.     }
  2266.     /**
  2267.      * @return Collection<int, RecruitVacancy>
  2268.      */
  2269.     public function getRecruitVacancies(): Collection
  2270.     {
  2271.         return $this->recruitVacancies;
  2272.     }
  2273.     public function addRecruitVacancy(RecruitVacancy $recruitVacancy): self
  2274.     {
  2275.         if (!$this->recruitVacancies->contains($recruitVacancy)) {
  2276.             $this->recruitVacancies->add($recruitVacancy);
  2277.             $recruitVacancy->setCreatedBy($this);
  2278.         }
  2279.         return $this;
  2280.     }
  2281.     public function removeRecruitVacancy(RecruitVacancy $recruitVacancy): self
  2282.     {
  2283.         if ($this->recruitVacancies->removeElement($recruitVacancy)) {
  2284.             // set the owning side to null (unless already changed)
  2285.             if ($recruitVacancy->getCreatedBy() === $this) {
  2286.                 $recruitVacancy->setCreatedBy(null);
  2287.             }
  2288.         }
  2289.         return $this;
  2290.     }
  2291.     /**
  2292.      * @return Collection<int, RecruitApplicationActivity>
  2293.      */
  2294.     public function getRecruitApplicationActivities(): Collection
  2295.     {
  2296.         return $this->recruitApplicationActivities;
  2297.     }
  2298.     public function addRecruitApplicationActivity(RecruitApplicationActivity $recruitApplicationActivity): self
  2299.     {
  2300.         if (!$this->recruitApplicationActivities->contains($recruitApplicationActivity)) {
  2301.             $this->recruitApplicationActivities->add($recruitApplicationActivity);
  2302.             $recruitApplicationActivity->setCreatedBy($this);
  2303.         }
  2304.         return $this;
  2305.     }
  2306.     public function removeRecruitApplicationActivity(RecruitApplicationActivity $recruitApplicationActivity): self
  2307.     {
  2308.         if ($this->recruitApplicationActivities->removeElement($recruitApplicationActivity)) {
  2309.             // set the owning side to null (unless already changed)
  2310.             if ($recruitApplicationActivity->getCreatedBy() === $this) {
  2311.                 $recruitApplicationActivity->setCreatedBy(null);
  2312.             }
  2313.         }
  2314.         return $this;
  2315.     }
  2316.     /**
  2317.      * @return Collection<int, RecruitApplicationComment>
  2318.      */
  2319.     public function getRecruitApplicationCommentsMultiple(): Collection
  2320.     {
  2321.         return $this->recruitApplicationCommentsMultiple;
  2322.     }
  2323.     public function addRecruitApplicationCommentsMultiple(RecruitApplicationComment $recruitApplicationCommentsMultiple): self
  2324.     {
  2325.         if (!$this->recruitApplicationCommentsMultiple->contains($recruitApplicationCommentsMultiple)) {
  2326.             $this->recruitApplicationCommentsMultiple->add($recruitApplicationCommentsMultiple);
  2327.             $recruitApplicationCommentsMultiple->setCommentBy($this);
  2328.         }
  2329.         return $this;
  2330.     }
  2331.     public function removeRecruitApplicationCommentsMultiple(RecruitApplicationComment $recruitApplicationCommentsMultiple): self
  2332.     {
  2333.         if ($this->recruitApplicationCommentsMultiple->removeElement($recruitApplicationCommentsMultiple)) {
  2334.             // set the owning side to null (unless already changed)
  2335.             if ($recruitApplicationCommentsMultiple->getCommentBy() === $this) {
  2336.                 $recruitApplicationCommentsMultiple->setCommentBy(null);
  2337.             }
  2338.         }
  2339.         return $this;
  2340.     }
  2341.     /**
  2342.      * @return Collection<int, RecruitQuestion>
  2343.      */
  2344.     public function getRecruitQuestions(): Collection
  2345.     {
  2346.         return $this->recruitQuestions;
  2347.     }
  2348.     public function addRecruitQuestion(RecruitQuestion $recruitQuestion): self
  2349.     {
  2350.         if (!$this->recruitQuestions->contains($recruitQuestion)) {
  2351.             $this->recruitQuestions->add($recruitQuestion);
  2352.             $recruitQuestion->setCreatedBy($this);
  2353.         }
  2354.         return $this;
  2355.     }
  2356.     public function removeRecruitQuestion(RecruitQuestion $recruitQuestion): self
  2357.     {
  2358.         if ($this->recruitQuestions->removeElement($recruitQuestion)) {
  2359.             // set the owning side to null (unless already changed)
  2360.             if ($recruitQuestion->getCreatedBy() === $this) {
  2361.                 $recruitQuestion->setCreatedBy(null);
  2362.             }
  2363.         }
  2364.         return $this;
  2365.     }
  2366.     /**
  2367.      * @return Collection<int, RecruitEvaluationScore>
  2368.      */
  2369.     public function getRecruitEvaluationScores(): Collection
  2370.     {
  2371.         return $this->recruitEvaluationScores;
  2372.     }
  2373.     public function addRecruitEvaluationScore(RecruitEvaluationScore $recruitEvaluationScore): self
  2374.     {
  2375.         if (!$this->recruitEvaluationScores->contains($recruitEvaluationScore)) {
  2376.             $this->recruitEvaluationScores->add($recruitEvaluationScore);
  2377.             $recruitEvaluationScore->setUser($this);
  2378.         }
  2379.         return $this;
  2380.     }
  2381.     public function removeRecruitEvaluationScore(RecruitEvaluationScore $recruitEvaluationScore): self
  2382.     {
  2383.         if ($this->recruitEvaluationScores->removeElement($recruitEvaluationScore)) {
  2384.             // set the owning side to null (unless already changed)
  2385.             if ($recruitEvaluationScore->getUser() === $this) {
  2386.                 $recruitEvaluationScore->setUser(null);
  2387.             }
  2388.         }
  2389.         return $this;
  2390.     }
  2391.     /**
  2392.      * @return Collection<int, RecruitApplication>
  2393.      */
  2394.     public function getRecruitApplications(): Collection
  2395.     {
  2396.         return $this->recruitApplications;
  2397.     }
  2398.     public function addRecruitApplication(RecruitApplication $recruitApplication): self
  2399.     {
  2400.         if (!$this->recruitApplications->contains($recruitApplication)) {
  2401.             $this->recruitApplications->add($recruitApplication);
  2402.             $recruitApplication->setReportingTo($this);
  2403.         }
  2404.         return $this;
  2405.     }
  2406.     public function removeRecruitApplication(RecruitApplication $recruitApplication): self
  2407.     {
  2408.         if ($this->recruitApplications->removeElement($recruitApplication)) {
  2409.             // set the owning side to null (unless already changed)
  2410.             if ($recruitApplication->getReportingTo() === $this) {
  2411.                 $recruitApplication->setReportingTo(null);
  2412.             }
  2413.         }
  2414.         return $this;
  2415.     }
  2416.     /**
  2417.      * @return Collection<int, RecruitDefaultApprover>
  2418.      */
  2419.     public function getDefaultApprovers(): Collection
  2420.     {
  2421.         return $this->defaultApprovers;
  2422.     }
  2423.     public function addDefaultApprover(RecruitDefaultApprover $defaultApprover): self
  2424.     {
  2425.         if (!$this->defaultApprovers->contains($defaultApprover)) {
  2426.             $this->defaultApprovers->add($defaultApprover);
  2427.             $defaultApprover->setUser($this);
  2428.         }
  2429.         return $this;
  2430.     }
  2431.     public function removeDefaultApprover(RecruitDefaultApprover $defaultApprover): self
  2432.     {
  2433.         if ($this->defaultApprovers->removeElement($defaultApprover)) {
  2434.             // set the owning side to null (unless already changed)
  2435.             if ($defaultApprover->getUser() === $this) {
  2436.                 $defaultApprover->setUser(null);
  2437.             }
  2438.         }
  2439.         return $this;
  2440.     }
  2441.     /**
  2442.      * @return Collection<int, RecruitVacancyHistory>
  2443.      */
  2444.     public function getRecruitVacancyHistories(): Collection
  2445.     {
  2446.         return $this->recruitVacancyHistories;
  2447.     }
  2448.     public function addRecruitVacancyHistory(RecruitVacancyHistory $recruitVacancyHistory): self
  2449.     {
  2450.         if (!$this->recruitVacancyHistories->contains($recruitVacancyHistory)) {
  2451.             $this->recruitVacancyHistories->add($recruitVacancyHistory);
  2452.             $recruitVacancyHistory->setCreatedBy($this);
  2453.         }
  2454.         return $this;
  2455.     }
  2456.     public function removeRecruitVacancyHistory(RecruitVacancyHistory $recruitVacancyHistory): self
  2457.     {
  2458.         if ($this->recruitVacancyHistories->removeElement($recruitVacancyHistory)) {
  2459.             // set the owning side to null (unless already changed)
  2460.             if ($recruitVacancyHistory->getCreatedBy() === $this) {
  2461.                 $recruitVacancyHistory->setCreatedBy(null);
  2462.             }
  2463.         }
  2464.         return $this;
  2465.     }
  2466.     /**
  2467.      * @return Collection<int, RecruitSettingActivity>
  2468.      */
  2469.     public function getRecruitSettingActivities(): Collection
  2470.     {
  2471.         return $this->recruitSettingActivities;
  2472.     }
  2473.     public function addRecruitSettingActivity(RecruitSettingActivity $recruitSettingActivity): self
  2474.     {
  2475.         if (!$this->recruitSettingActivities->contains($recruitSettingActivity)) {
  2476.             $this->recruitSettingActivities->add($recruitSettingActivity);
  2477.             $recruitSettingActivity->setUser($this);
  2478.         }
  2479.         return $this;
  2480.     }
  2481.     public function removeRecruitSettingActivity(RecruitSettingActivity $recruitSettingActivity): self
  2482.     {
  2483.         if ($this->recruitSettingActivities->removeElement($recruitSettingActivity)) {
  2484.             // set the owning side to null (unless already changed)
  2485.             if ($recruitSettingActivity->getUser() === $this) {
  2486.                 $recruitSettingActivity->setUser(null);
  2487.             }
  2488.         }
  2489.         return $this;
  2490.     }
  2491.     /**
  2492.      * @return Collection<int, RecruitTalentSearchSession>
  2493.      */
  2494.     public function getRecruitTalentSearchSessions(): Collection
  2495.     {
  2496.         return $this->recruitTalentSearchSessions;
  2497.     }
  2498.     public function addRecruitTalentSearchSession(RecruitTalentSearchSession $recruitTalentSearchSession): self
  2499.     {
  2500.         if (!$this->recruitTalentSearchSessions->contains($recruitTalentSearchSession)) {
  2501.             $this->recruitTalentSearchSessions->add($recruitTalentSearchSession);
  2502.             $recruitTalentSearchSession->setUser($this);
  2503.         }
  2504.         return $this;
  2505.     }
  2506.     public function removeRecruitTalentSearchSession(RecruitTalentSearchSession $recruitTalentSearchSession): self
  2507.     {
  2508.         if ($this->recruitTalentSearchSessions->removeElement($recruitTalentSearchSession)) {
  2509.             // set the owning side to null (unless already changed)
  2510.             if ($recruitTalentSearchSession->getUser() === $this) {
  2511.                 $recruitTalentSearchSession->setUser(null);
  2512.             }
  2513.         }
  2514.         return $this;
  2515.     }
  2516.     /**
  2517.      * @return Collection<int, RecruitApplication>
  2518.      */
  2519.     public function getApplicationsAsInterviewer(): Collection
  2520.     {
  2521.         return $this->applicationsAsInterviewer;
  2522.     }
  2523.     public function addApplicationsAsInterviewer(RecruitApplication $applicationsAsInterviewer): self
  2524.     {
  2525.         if (!$this->applicationsAsInterviewer->contains($applicationsAsInterviewer)) {
  2526.             $this->applicationsAsInterviewer->add($applicationsAsInterviewer);
  2527.             $applicationsAsInterviewer->setInterviewer($this);
  2528.         }
  2529.         return $this;
  2530.     }
  2531.     public function removeApplicationsAsInterviewer(RecruitApplication $applicationsAsInterviewer): self
  2532.     {
  2533.         if ($this->applicationsAsInterviewer->removeElement($applicationsAsInterviewer)) {
  2534.             // set the owning side to null (unless already changed)
  2535.             if ($applicationsAsInterviewer->getInterviewer() === $this) {
  2536.                 $applicationsAsInterviewer->setInterviewer(null);
  2537.             }
  2538.         }
  2539.         return $this;
  2540.     }
  2541.     /**
  2542.      * @return Collection<int, RecruitApplication>
  2543.      */
  2544.     public function getHrInterviewer(): Collection
  2545.     {
  2546.         return $this->hrInterviewer;
  2547.     }
  2548.     public function addHrInterviewer(RecruitApplication $hrInterviewer): self
  2549.     {
  2550.         if (!$this->hrInterviewer->contains($hrInterviewer)) {
  2551.             $this->hrInterviewer->add($hrInterviewer);
  2552.             $hrInterviewer->setHrInterviewer($this);
  2553.         }
  2554.         return $this;
  2555.     }
  2556.     public function removeHrInterviewer(RecruitApplication $hrInterviewer): self
  2557.     {
  2558.         if ($this->hrInterviewer->removeElement($hrInterviewer)) {
  2559.             // set the owning side to null (unless already changed)
  2560.             if ($hrInterviewer->getHrInterviewer() === $this) {
  2561.                 $hrInterviewer->setHrInterviewer(null);
  2562.             }
  2563.         }
  2564.         return $this;
  2565.     }
  2566.     /**
  2567.      * @return Collection<int, WorkingFromAbroad>
  2568.      */
  2569.     public function getWorkingFromAbroads(): Collection
  2570.     {
  2571.         return $this->workingFromAbroads;
  2572.     }
  2573.     public function getTotalWfaDays()
  2574.     {
  2575.         $total 0;
  2576.         if ($this->workingFromAbroads) {
  2577.             foreach ($this->workingFromAbroads as $wfa) {
  2578.                 if ($wfa->getStatus() >= && $wfa->isIsApproved() == true) {
  2579.                     $total += $wfa->getWfaDays();
  2580.                 }
  2581.             }
  2582.         }
  2583.         return $total;
  2584.     }
  2585.     public function getTotalWfaDaysLeft()
  2586.     {
  2587.         $left 40;
  2588.         if ($this->getTotalWfaDays()) {
  2589.             $left 40 $this->getTotalWfaDays();
  2590.         }
  2591.         return $left;
  2592.     }
  2593.     public function addWorkingFromAbroad(WorkingFromAbroad $workingFromAbroad): self
  2594.     {
  2595.         if (!$this->workingFromAbroads->contains($workingFromAbroad)) {
  2596.             $this->workingFromAbroads->add($workingFromAbroad);
  2597.             $workingFromAbroad->setUser($this);
  2598.         }
  2599.         return $this;
  2600.     }
  2601.     public function removeWorkingFromAbroad(WorkingFromAbroad $workingFromAbroad): self
  2602.     {
  2603.         if ($this->workingFromAbroads->removeElement($workingFromAbroad)) {
  2604.             // set the owning side to null (unless already changed)
  2605.             if ($workingFromAbroad->getUser() === $this) {
  2606.                 $workingFromAbroad->setUser(null);
  2607.             }
  2608.         }
  2609.         return $this;
  2610.     }
  2611.     /*
  2612.      * @return Collection<int, ChecklistTask>
  2613.      */
  2614.     public function getChecklistTasksAsAssignee(): Collection
  2615.     {
  2616.         return $this->checklistTasksAsAssignee;
  2617.     }
  2618.     public function addChecklistTasksAsAssignee(ChecklistTask $checklistTasksAsAssignee): self
  2619.     {
  2620.         if (!$this->checklistTasksAsAssignee->contains($checklistTasksAsAssignee)) {
  2621.             $this->checklistTasksAsAssignee->add($checklistTasksAsAssignee);
  2622.             $checklistTasksAsAssignee->setDefaultAssignee($this);
  2623.         }
  2624.         return $this;
  2625.     }
  2626.     public function removeChecklistTasksAsAssignee(ChecklistTask $checklistTasksAsAssignee): self
  2627.     {
  2628.         if ($this->checklistTasksAsAssignee->removeElement($checklistTasksAsAssignee)) {
  2629.             // set the owning side to null (unless already changed)
  2630.             if ($checklistTasksAsAssignee->getDefaultAssignee() === $this) {
  2631.                 $checklistTasksAsAssignee->setDefaultAssignee(null);
  2632.             }
  2633.         }
  2634.         return $this;
  2635.     }
  2636.     /**
  2637.      * @return Collection<int, ChecklistTask>
  2638.      */
  2639.     public function getChecklistTaskAsVerifier(): Collection
  2640.     {
  2641.         return $this->checklistTaskAsVerifier;
  2642.     }
  2643.     public function addChecklistTaskAsVerifier(ChecklistTask $checklistTaskAsVerifier): self
  2644.     {
  2645.         if (!$this->checklistTaskAsVerifier->contains($checklistTaskAsVerifier)) {
  2646.             $this->checklistTaskAsVerifier->add($checklistTaskAsVerifier);
  2647.             $checklistTaskAsVerifier->setVerifier($this);
  2648.         }
  2649.         return $this;
  2650.     }
  2651.     public function removeChecklistTaskAsVerifier(ChecklistTask $checklistTaskAsVerifier): self
  2652.     {
  2653.         if ($this->checklistTaskAsVerifier->removeElement($checklistTaskAsVerifier)) {
  2654.             // set the owning side to null (unless already changed)
  2655.             if ($checklistTaskAsVerifier->getVerifier() === $this) {
  2656.                 $checklistTaskAsVerifier->setVerifier(null);
  2657.             }
  2658.         }
  2659.         return $this;
  2660.     }
  2661.     /**
  2662.      * @return Collection<int, Checklist>
  2663.      */
  2664.     public function getChecklistsAsAssignee(): Collection
  2665.     {
  2666.         return $this->checklistsAsAssignee;
  2667.     }
  2668.     public function addChecklistsAsAssignee(Checklist $checklistsAsAssignee): self
  2669.     {
  2670.         if (!$this->checklistsAsAssignee->contains($checklistsAsAssignee)) {
  2671.             $this->checklistsAsAssignee->add($checklistsAsAssignee);
  2672.             $checklistsAsAssignee->setDefaultAssignee($this);
  2673.         }
  2674.         return $this;
  2675.     }
  2676.     public function removeChecklistsAsAssignee(Checklist $checklistsAsAssignee): self
  2677.     {
  2678.         if ($this->checklistsAsAssignee->removeElement($checklistsAsAssignee)) {
  2679.             // set the owning side to null (unless already changed)
  2680.             if ($checklistsAsAssignee->getDefaultAssignee() === $this) {
  2681.                 $checklistsAsAssignee->setDefaultAssignee(null);
  2682.             }
  2683.         }
  2684.         return $this;
  2685.     }
  2686.     /**
  2687.      * @return Collection<int, Checklist>
  2688.      */
  2689.     public function getChecklistsAsOwner(): Collection
  2690.     {
  2691.         return $this->checklistsAsOwner;
  2692.     }
  2693.     public function addChecklistsAsOwner(Checklist $checklistsAsOwner): self
  2694.     {
  2695.         if (!$this->checklistsAsOwner->contains($checklistsAsOwner)) {
  2696.             $this->checklistsAsOwner->add($checklistsAsOwner);
  2697.             $checklistsAsOwner->setOwner($this);
  2698.         }
  2699.         return $this;
  2700.     }
  2701.     public function removeChecklistsAsOwner(Checklist $checklistsAsOwner): self
  2702.     {
  2703.         if ($this->checklistsAsOwner->removeElement($checklistsAsOwner)) {
  2704.             // set the owning side to null (unless already changed)
  2705.             if ($checklistsAsOwner->getOwner() === $this) {
  2706.                 $checklistsAsOwner->setOwner(null);
  2707.             }
  2708.         }
  2709.         return $this;
  2710.     }
  2711.     /**
  2712.      * @return Collection<int, Checklist>
  2713.      */
  2714.     public function getOnboardedChecklists(): Collection
  2715.     {
  2716.         return $this->onboardedChecklists;
  2717.     }
  2718.     public function addOnboardedChecklist(Checklist $onboardedChecklist): self
  2719.     {
  2720.         if (!$this->onboardedChecklists->contains($onboardedChecklist)) {
  2721.             $this->onboardedChecklists->add($onboardedChecklist);
  2722.             $onboardedChecklist->setOnboardUser($this);
  2723.         }
  2724.         return $this;
  2725.     }
  2726.     public function removeOnboardedChecklist(Checklist $onboardedChecklist): self
  2727.     {
  2728.         if ($this->onboardedChecklists->removeElement($onboardedChecklist)) {
  2729.             // set the owning side to null (unless already changed)
  2730.             if ($onboardedChecklist->getOnboardUser() === $this) {
  2731.                 $onboardedChecklist->setOnboardUser(null);
  2732.             }
  2733.         }
  2734.         return $this;
  2735.     }
  2736.     public function getOnboardedChecklistsByType($type)
  2737.     {
  2738.         $onboardedChecklists = [];
  2739.         foreach ($this->onboardedChecklists as $onboardedChecklist) {
  2740.             if ($onboardedChecklist->getStatus() != 'ACTIVE') continue;
  2741.             if ($onboardedChecklist->getType() == $typearray_push($onboardedChecklists$onboardedChecklist);
  2742.         }
  2743.         return $onboardedChecklists;
  2744.     }
  2745.     /**
  2746.      * @return Collection<int, ChecklistActivity>
  2747.      */
  2748.     public function getChecklistActivities(): Collection
  2749.     {
  2750.         return $this->checklistActivities;
  2751.     }
  2752.     public function addChecklistActivity(ChecklistActivity $checklistActivity): self
  2753.     {
  2754.         if (!$this->checklistActivities->contains($checklistActivity)) {
  2755.             $this->checklistActivities->add($checklistActivity);
  2756.             $checklistActivity->setUser($this);
  2757.         }
  2758.         return $this;
  2759.     }
  2760.     public function removeChecklistActivity(ChecklistActivity $checklistActivity): self
  2761.     {
  2762.         if ($this->checklistActivities->removeElement($checklistActivity)) {
  2763.             // set the owning side to null (unless already changed)
  2764.             if ($checklistActivity->getUser() === $this) {
  2765.                 $checklistActivity->setUser(null);
  2766.             }
  2767.         }
  2768.         return $this;
  2769.     }
  2770.     /**
  2771.      * @return Collection<int, ChatbotThreads>
  2772.      */
  2773.     public function getChatbotThreads(): Collection
  2774.     {
  2775.         return $this->chatbotThreads;
  2776.     }
  2777.     public function addChatbotThread(ChatbotThreads $chatbotThread): self
  2778.     {
  2779.         if (!$this->chatbotThreads->contains($chatbotThread)) {
  2780.             $this->chatbotThreads->add($chatbotThread);
  2781.             $chatbotThread->setUserId($this);
  2782.         }
  2783.         return $this;
  2784.     }
  2785.     public function removeChatbotThread(ChatbotThreads $chatbotThread): self
  2786.     {
  2787.         if ($this->chatbotThreads->removeElement($chatbotThread)) {
  2788.             // set the owning side to null (unless already changed)
  2789.             if ($chatbotThread->getUserId() === $this) {
  2790.                 $chatbotThread->setUserId(null);
  2791.             }
  2792.         }
  2793.         return $this;
  2794.     }
  2795.     /**
  2796.      * @return Collection<int, ChatbotSection>
  2797.      */
  2798.     public function getChatbotSections(): Collection
  2799.     {
  2800.         return $this->chatbotSections;
  2801.     }
  2802.     public function addChatbotSection(ChatbotSection $chatbotSection): self
  2803.     {
  2804.         if (!$this->chatbotSections->contains($chatbotSection)) {
  2805.             $this->chatbotSections->add($chatbotSection);
  2806.             $chatbotSection->setCreatedBy($this);
  2807.         }
  2808.         return $this;
  2809.     }
  2810.     public function removeChatbotSection(ChatbotSection $chatbotSection): self
  2811.     {
  2812.         if ($this->chatbotSections->removeElement($chatbotSection)) {
  2813.             // set the owning side to null (unless already changed)
  2814.             if ($chatbotSection->getCreatedBy() === $this) {
  2815.                 $chatbotSection->setCreatedBy(null);
  2816.             }
  2817.         }
  2818.         return $this;
  2819.     }
  2820.     /**
  2821.      * @return Collection<int, ChatbotPrompt>
  2822.      */
  2823.     public function getChatbotPrompts(): Collection
  2824.     {
  2825.         return $this->chatbotPrompts;
  2826.     }
  2827.     public function addChatbotPrompt(ChatbotPrompt $chatbotPrompt): self
  2828.     {
  2829.         if (!$this->chatbotPrompts->contains($chatbotPrompt)) {
  2830.             $this->chatbotPrompts->add($chatbotPrompt);
  2831.             $chatbotPrompt->setCreatedBy($this);
  2832.         }
  2833.         return $this;
  2834.     }
  2835.     public function removeChatbotPrompt(ChatbotPrompt $chatbotPrompt): self
  2836.     {
  2837.         if ($this->chatbotPrompts->removeElement($chatbotPrompt)) {
  2838.             // set the owning side to null (unless already changed)
  2839.             if ($chatbotPrompt->getCreatedBy() === $this) {
  2840.                 $chatbotPrompt->setCreatedBy(null);
  2841.             }
  2842.         }
  2843.         return $this;
  2844.     }
  2845.     /**
  2846.      * @return Collection<int, ChatbotCompanyPrompt>
  2847.      */
  2848.     public function getChatbotCompanyPrompts(): Collection
  2849.     {
  2850.         return $this->chatbotCompanyPrompts;
  2851.     }
  2852.     public function addChatbotCompanyPrompt(ChatbotCompanyPrompt $chatbotCompanyPrompt): self
  2853.     {
  2854.         if (!$this->chatbotCompanyPrompts->contains($chatbotCompanyPrompt)) {
  2855.             $this->chatbotCompanyPrompts->add($chatbotCompanyPrompt);
  2856.             $chatbotCompanyPrompt->setCreatedBy($this);
  2857.         }
  2858.         return $this;
  2859.     }
  2860.     public function removeChatbotCompanyPrompt(ChatbotCompanyPrompt $chatbotCompanyPrompt): self
  2861.     {
  2862.         if ($this->chatbotCompanyPrompts->removeElement($chatbotCompanyPrompt)) {
  2863.             // set the owning side to null (unless already changed)
  2864.             if ($chatbotCompanyPrompt->getCreatedBy() === $this) {
  2865.                 $chatbotCompanyPrompt->setCreatedBy(null);
  2866.             }
  2867.         }
  2868.         return $this;
  2869.     }
  2870.     /**
  2871.      * @return Collection<int, ChatbotFaq>
  2872.      */
  2873.     public function getChatbotFaqs(): Collection
  2874.     {
  2875.         return $this->chatbotFaqs;
  2876.     }
  2877.     public function addChatbotFaq(ChatbotFaq $chatbotFaq): self
  2878.     {
  2879.         if (!$this->chatbotFaqs->contains($chatbotFaq)) {
  2880.             $this->chatbotFaqs->add($chatbotFaq);
  2881.             $chatbotFaq->setUpdatedBy($this);
  2882.         }
  2883.         return $this;
  2884.     }
  2885.     public function removeChatbotFaq(ChatbotFaq $chatbotFaq): self
  2886.     {
  2887.         if ($this->chatbotFaqs->removeElement($chatbotFaq)) {
  2888.             // set the owning side to null (unless already changed)
  2889.             if ($chatbotFaq->getUpdatedBy() === $this) {
  2890.                 $chatbotFaq->setUpdatedBy(null);
  2891.             }
  2892.         }
  2893.         return $this;
  2894.     }
  2895.     /**
  2896.      * @return Collection<int, ProjectDynamicField>
  2897.      */
  2898.     public function getProjectDynamicFields(): Collection
  2899.     {
  2900.         return $this->projectDynamicFields;
  2901.     }
  2902.     public function addProjectDynamicField(ProjectDynamicField $projectDynamicField): self
  2903.     {
  2904.         if (!$this->projectDynamicFields->contains($projectDynamicField)) {
  2905.             $this->projectDynamicFields->add($projectDynamicField);
  2906.             $projectDynamicField->setCreatedBy($this);
  2907.         }
  2908.         return $this;
  2909.     }
  2910.     public function removeProjectDynamicField(ProjectDynamicField $projectDynamicField): self
  2911.     {
  2912.         if ($this->projectDynamicFields->removeElement($projectDynamicField)) {
  2913.             // set the owning side to null (unless already changed)
  2914.             if ($projectDynamicField->getCreatedBy() === $this) {
  2915.                 $projectDynamicField->setCreatedBy(null);
  2916.             }
  2917.         }
  2918.         return $this;
  2919.     }
  2920.     /**
  2921.      * @return Collection<int, XeroUser>
  2922.      */
  2923.     public function getXeroUsers(): Collection
  2924.     {
  2925.         return $this->xeroUsers;
  2926.     }
  2927.     public function addXeroUser(XeroUser $xeroUser): self
  2928.     {
  2929.         if (!$this->xeroUsers->contains($xeroUser)) {
  2930.             $this->xeroUsers->add($xeroUser);
  2931.             $xeroUser->setUser($this);
  2932.         }
  2933.         return $this;
  2934.     }
  2935.     public function removeXeroUser(XeroUser $xeroUser): self
  2936.     {
  2937.         if ($this->xeroUsers->removeElement($xeroUser)) {
  2938.             // set the owning side to null (unless already changed)
  2939.             if ($xeroUser->getUser() === $this) {
  2940.                 $xeroUser->setUser(null);
  2941.             }
  2942.         }
  2943.         return $this;
  2944.     }
  2945. }