src/Entity/Slave/User.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Slave;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\DBAL\Types\Types;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Security\Core\User\UserInterface;
  8. use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
  9. /**
  10.  * @ORM\Table(name="eposm_s_user")
  11.  * @ORM\Entity(repositoryClass="App\Repository\Slave\UserRepository")
  12.  * @ORM\HasLifecycleCallbacks()
  13.  */
  14. class User implements UserInterfacePasswordAuthenticatedUserInterface
  15. {
  16.     public function __toString(){
  17.         return $this->profile->getSurname().' '.$this->profile->getName(); 
  18.     }
  19.     
  20.     public function getNameShort(){
  21.         return $this->profile->getSurname().' '.substr($this->profile->getName(), 01).'.'
  22.     }
  23.     public function displayNameAndCountTickets(){
  24.         return $this->profile->getSurname().' '.$this->profile->getName().' ('.$this->countTicketsUnderManagement('actual').' / '.$this->countTicketsUnderManagement('suspension').')';
  25.     }
  26.     public function getPermissionType($permissionSlug){
  27.         foreach($this->getAccountType()->getPermissions() as $jt){
  28.             if($jt->getPermission()->getSlug() == $permissionSlug)
  29.                 return $jt->getRw();
  30.         }
  31.         return "";
  32.     }
  33.     public function getPermissionWarehouse($warehouseId){
  34.         foreach($this->getWarehouses() as $jt){
  35.             if($jt->getWarehouse()->getId() == $warehouseId)
  36.                 return $jt->getPermission();
  37.         }
  38.         return "";
  39.     }
  40.     public function getPermissionTransfer($transferId){
  41.         foreach($this->getTransfersUserFrom() as $tf){
  42.             if($this->getPermissionWarehouse($tf->getWarehouseFrom()) == "RW" || $this->getPermissionWarehouse($tf->getWarehouseTo()) == "RW");
  43.                 return true;
  44.         }
  45.         foreach($this->getTransfersUserTo() as $tt){
  46.             if($this->getPermissionWarehouse($tt->getWarehouseFrom()) == "RW" || $this->getPermissionWarehouse($tt->getWarehouseTo()) == "RW");
  47.                 return true;
  48.         }
  49.         return false;
  50.     }
  51.     public function getPermissionTicket($ticketId){
  52.         if($this->getAccountTypology() != 'technician')
  53.             return true;
  54.         else{
  55.             foreach($this->getTickets() as $t){
  56.                 if($t->getId() == $ticketId)
  57.                     return true;
  58.             }
  59.         }
  60.         return false;
  61.     }
  62.     public function getAccountTypology(){
  63.         switch($this->getAccountType()->getCategory()->getSlug()){
  64.             case 'agency':
  65.             case 'administration':
  66.             case 'commercial':
  67.             case 'warehouse':
  68.                 return $this->getAccountType()->getCategory()->getSlug();
  69.                 break;
  70.             case 'tech-internal':
  71.             case 'tech-external':
  72.                 return 'technician';
  73.                 break;
  74.             default: break;
  75.         }
  76.     }
  77.     public function canMakeTicketActions($type$settingBackOfficeValue){
  78.         switch($type){
  79.             case 'technician':
  80.                 if($this->getAccountTypology() == 'technician' || (($this->getAccountTypology() == 'agency' || $this->getAccountTypology() == 'warehouse') && $settingBackOfficeValue))
  81.                     return true;
  82.                 break;
  83.             case 'only_backoffice':
  84.                 if(($this->getAccountTypology() == 'agency' || $this->getAccountTypology() == 'warehouse') && $settingBackOfficeValue)
  85.                     return true;
  86.                 break;
  87.             case 'agency_warehouse':
  88.                 if($this->getAccountTypology() == 'agency' || $this->getAccountTypology() == 'warehouse')
  89.                     return true;
  90.                 break;
  91.             default: break;
  92.         }
  93.         return false;
  94.     }
  95.     public function getCanDelete(){
  96.         if(sizeof($this->warehouses) > 0) return false;
  97.         if(sizeof($this->technicianAreas) > 0) return false;
  98.         if(sizeof($this->tickets) > 0) return false;
  99.         if(sizeof($this->interventions) > 0) return false;
  100.         return true;
  101.     }
  102.     
  103.     public function isInHolidayAtDate($date){
  104.         $holidays = array();
  105.         foreach($this->getHolidays() as $h){
  106.             if($date->format('Ymd') >= $h->getDateFrom()->format('Ymd') && $date->format('Ymd') <= $h->getDateTo()->format('Ymd'))
  107.                 return true;
  108.         }
  109.         return false;
  110.     }
  111.     public function getActualHoliday(){
  112.         $today = new \Datetime();
  113.         $holidays = array();
  114.         foreach($this->getHolidays() as $h){
  115.             if($today->format('Ymd') >= $h->getDateFrom()->format('Ymd') && $today->format('Ymd') <= $h->getDateTo()->format('Ymd'))
  116.                 return $h;
  117.         }
  118.         return false;
  119.     }
  120.     public function canRead($area){
  121.         foreach($this->getAccountType()->getPermissions() as $jt){
  122.             if($area == $jt->getPermission()->getSlug()){
  123.                 return true;
  124.                 break;
  125.             }
  126.         }
  127.     }
  128.     
  129.     public function canWrite($area){
  130.         foreach($this->getAccountType()->getPermissions() as $jt){
  131.             if($area == $jt->getPermission()->getSlug() && $jt->getRW() == 'RW'){
  132.                 return true;
  133.                 break;
  134.             }
  135.         }
  136.     }
  137.     
  138.     public function canViewTab($tabSlug){
  139.         foreach($this->getAccountType()->getPermissions() as $jt){
  140.             if(str_contains($jt->getPermission()->getSlug(), $tabSlug)){
  141.                 return true;
  142.                 break;
  143.             }
  144.         }
  145.         return false;
  146.     }
  147.     public function countTicketsUnderManagement($type){
  148.         $count 0;
  149.         foreach($this->getTickets() as $ticket){
  150.             switch($type){
  151.                 case 'actual': if($ticket->getStatus()->getSlug() == 'assigned' || $ticket->getStatus()->getSlug() == 'taken_charge'$count++; break;
  152.                 case 'suspension': if($ticket->getStatus()->getSlug() == 'suspension_request' || $ticket->getStatus()->getSlug() == 'suspended'$count++; break;
  153.                 case 'actual_and_suspension': if($ticket->getStatus()->getSlug() == 'assigned' || $ticket->getStatus()->getSlug() == 'taken_charge' || $ticket->getStatus()->getSlug() == 'suspension_request' || $ticket->getStatus()->getSlug() == 'suspended'$count++; break;
  154.                 case 'closed': if($ticket->getStatus()->getSlug() == 'closed' || $ticket->getStatus()->getSlug() == 'closed_portal'$count++; break;
  155.                 default: break;
  156.             }
  157.         }
  158.         return $count;
  159.     }
  160.     
  161.     public function mainWarehouse(){
  162.         if(sizeof($this->getWarehouses()) == 1)
  163.             return $this->getWarehouses()[0]->getWarehouse();
  164.         foreach($this->getWarehouses() as $jtuw){
  165.             if($jtuw->isMain())
  166.                 return $jtuw->getWarehouse();
  167.         }
  168.         return null;
  169.     }
  170.     
  171.     /**
  172.      * @ORM\Column(name="id", type="bigint")
  173.      * @ORM\Id
  174.      * @ORM\GeneratedValue(strategy="AUTO")
  175.      */
  176.     protected $id;
  177.     
  178.     /**
  179.      * @ORM\Column(name="email", type="string", length=191, unique=true)
  180.      */
  181.     protected $email;
  182.     
  183.     /**
  184.      * @ORM\Column(name="password", type="string", length=191, nullable=true)
  185.      */
  186.     protected $password;
  187.     
  188.     /**
  189.      * @ORM\Column(name="role", type="string", length=191)
  190.      */
  191.     protected $role "ROLE_USER";
  192.     
  193.     /**
  194.      * @ORM\Column(name="one_time_code", type="string", length=191, nullable=true)
  195.      */
  196.     protected $oneTimeCode;
  197.     
  198.     /**
  199.      * @ORM\Column(name="expiration_one_time_code", type="datetime", nullable=true)
  200.      */
  201.     protected $expirationOneTimeCode;
  202.         
  203.     /**
  204.      * @ORM\Column(name="is_active", type="boolean")
  205.      */
  206.     protected $active false;
  207.     /**
  208.      * @ORM\Column(name="is_company_active", type="boolean")
  209.      */
  210.     protected $companyActive true;
  211.         
  212.     /**
  213.      * @ORM\Column(name="is_admin_active", type="boolean")
  214.      */
  215.     protected $adminActive true;
  216.     
  217.     /**
  218.      * @ORM\Column(name="exclude_auto_assign", type="boolean")
  219.      */
  220.     protected $excludeAutoAssign false;
  221.     
  222.     /**
  223.      * @ORM\Column(name="is_economic_visible", type="boolean")
  224.      */
  225.     protected $economicVisible true;
  226.     
  227.     // OneToOne
  228.         /**
  229.         * @ORM\OneToOne(targetEntity="App\Entity\Slave\UserProfile", mappedBy="user")
  230.         */
  231.         private $profile;
  232.     //
  233.     // ManyToOne
  234.         /**
  235.          * @ORM\ManyToOne(targetEntity="App\Entity\Slave\AccountType", inversedBy="users")
  236.          * @ORM\JoinColumn(name="account_type_id", referencedColumnName="id")
  237.          */
  238.         private $accountType;
  239.     //
  240.     // OneToMany
  241.         /**
  242.          * @ORM\OneToMany(targetEntity="App\Entity\Slave\UserDocument", mappedBy="user")
  243.          */
  244.         private $documents;
  245.         
  246.         /**
  247.          * @ORM\OneToMany(targetEntity="App\Entity\Slave\UserHoliday", mappedBy="user")
  248.          */
  249.         private $holidays;
  250.         
  251.         /**
  252.          * @ORM\OneToMany(targetEntity="App\Entity\Slave\UserHoliday", mappedBy="substitute")
  253.          */
  254.         private $substitutions;
  255.         /**
  256.          * @ORM\OneToMany(targetEntity="App\Entity\Slave\JoinTableUserWarehouse", mappedBy="user")
  257.          */
  258.         private $warehouses;
  259.         /**
  260.          * @ORM\OneToMany(targetEntity="App\Entity\Slave\TechnicianArea", mappedBy="user")
  261.          */
  262.         private $technicianAreas;
  263.         
  264.         /**
  265.          * @ORM\OneToMany(targetEntity="App\Entity\Slave\JoinTableUserSupplier", mappedBy="user")
  266.          */
  267.         private $suppliers;
  268.         
  269.         /**
  270.          * @ORM\OneToMany(targetEntity="App\Entity\Slave\ProductTransferLog", mappedBy="user")
  271.          */
  272.         private $transferLogs;
  273.         /**
  274.          * @ORM\OneToMany(targetEntity="App\Entity\Slave\ProductTransfer", mappedBy="userFrom")
  275.          */
  276.         private $transfersUserFrom;
  277.         /**
  278.          * @ORM\OneToMany(targetEntity="App\Entity\Slave\ProductTransfer", mappedBy="userTo")
  279.          */
  280.         private $transfersUserTo;
  281.         /**
  282.          * @ORM\OneToMany(targetEntity="App\Entity\Slave\Ticket", mappedBy="technician")
  283.          */
  284.         private $tickets;
  285.         /**
  286.          * @ORM\OneToMany(targetEntity="App\Entity\Slave\Intervention", mappedBy="technician")
  287.          */
  288.         private $interventions;
  289.         
  290.         /**
  291.          * @ORM\OneToMany(targetEntity="App\Entity\Slave\Intervention", mappedBy="operator")
  292.          */
  293.         private $operatorInterventions;
  294.         /**
  295.          * @ORM\OneToMany(targetEntity="App\Entity\Slave\ProductRequest", mappedBy="technician")
  296.          */
  297.         private $productRequests;        
  298.         /**
  299.          * @ORM\OneToMany(targetEntity="App\Entity\Slave\TicketReminder", mappedBy="technician")
  300.          */
  301.         private $reminders;
  302.     //
  303.     // ManyToMany
  304.         /**
  305.          * @ORM\ManyToMany(targetEntity="App\Entity\Slave\Supplier", inversedBy="autoAssignUsers")
  306.          * @ORM\JoinTable(name="eposm_s_join_table_user_supplier_auto_assign")
  307.          */
  308.         private $autoAssignSuppliers;
  309.         public function __construct()
  310.         {
  311.             $this->documents = new ArrayCollection();
  312.             $this->holidays = new ArrayCollection();
  313.             $this->substitutions = new ArrayCollection();
  314.             $this->warehouses = new ArrayCollection();
  315.             $this->technicianAreas = new ArrayCollection();
  316.             $this->suppliers = new ArrayCollection();
  317.             $this->transferLogs = new ArrayCollection();
  318.             $this->transfersUserFrom = new ArrayCollection();
  319.             $this->transfersUserTo = new ArrayCollection();
  320.             $this->tickets = new ArrayCollection();
  321.             $this->interventions = new ArrayCollection();
  322.             $this->productRequests = new ArrayCollection();
  323.             $this->operatorInterventions = new ArrayCollection();
  324.             $this->autoAssignSuppliers = new ArrayCollection();
  325.             $this->reminders = new ArrayCollection();
  326.         }
  327.     //
  328.     /**
  329.      * @inheritdoc
  330.      */
  331.     public function getRoles(): array
  332.     {
  333.         switch($this->role){
  334.             case 'ROLE_USER': return array('ROLE_USER');
  335.         };
  336.     }
  337.     public function getSalt(): ?string
  338.     {
  339.         return null;
  340.     }
  341.     /**
  342.      * @see UserInterface
  343.      */
  344.     public function eraseCredentials()
  345.     {
  346.     }
  347.     
  348.     public function getUserIdentifier(): string
  349.     {
  350.         return (string) $this->email;
  351.     }
  352.     public function getUsername(): string
  353.     {
  354.         return (string) $this->email;
  355.     }
  356.     public function getPassword(): ?string
  357.     {
  358.         return $this->password;
  359.     }
  360.     public function setPassword(?string $password): self
  361.     {
  362.         $this->password $password;
  363.         return $this;
  364.     }
  365.     public function getId(): ?string
  366.     {
  367.         return $this->id;
  368.     }
  369.     public function getEmail(): ?string
  370.     {
  371.         return $this->email;
  372.     }
  373.     public function setEmail(string $email): self
  374.     {
  375.         $this->email $email;
  376.         return $this;
  377.     }
  378.     public function getRole(): ?string
  379.     {
  380.         return $this->role;
  381.     }
  382.     public function setRole(string $role): self
  383.     {
  384.         $this->role $role;
  385.         return $this;
  386.     }
  387.     public function getOneTimeCode(): ?string
  388.     {
  389.         return $this->oneTimeCode;
  390.     }
  391.     public function setOneTimeCode(?string $oneTimeCode): static
  392.     {
  393.         $this->oneTimeCode $oneTimeCode;
  394.         return $this;
  395.     }
  396.     public function getExpirationOneTimeCode(): ?\DateTimeInterface
  397.     {
  398.         return $this->expirationOneTimeCode;
  399.     }
  400.     public function setExpirationOneTimeCode(?\DateTimeInterface $expirationOneTimeCode): static
  401.     {
  402.         $this->expirationOneTimeCode $expirationOneTimeCode;
  403.         return $this;
  404.     }
  405.     public function isActive(): ?bool
  406.     {
  407.         return $this->active;
  408.     }
  409.     public function setActive(bool $active): static
  410.     {
  411.         $this->active $active;
  412.         return $this;
  413.     }
  414.     public function isCompanyActive(): ?bool
  415.     {
  416.         return $this->companyActive;
  417.     }
  418.     public function setCompanyActive(bool $companyActive): static
  419.     {
  420.         $this->companyActive $companyActive;
  421.         return $this;
  422.     }
  423.     public function isAdminActive(): ?bool
  424.     {
  425.         return $this->adminActive;
  426.     }
  427.     public function setAdminActive(bool $adminActive): static
  428.     {
  429.         $this->adminActive $adminActive;
  430.         return $this;
  431.     }
  432.     public function isExcludeAutoAssign(): ?bool
  433.     {
  434.         return $this->excludeAutoAssign;
  435.     }
  436.     public function setExcludeAutoAssign(bool $excludeAutoAssign): static
  437.     {
  438.         $this->excludeAutoAssign $excludeAutoAssign;
  439.         return $this;
  440.     }
  441.     public function isEconomicVisible(): ?bool
  442.     {
  443.         return $this->economicVisible;
  444.     }
  445.     public function setEconomicVisible(bool $economicVisible): static
  446.     {
  447.         $this->economicVisible $economicVisible;
  448.         return $this;
  449.     }
  450.     public function getProfile(): ?UserProfile
  451.     {
  452.         return $this->profile;
  453.     }
  454.     public function setProfile(?UserProfile $profile): static
  455.     {
  456.         // unset the owning side of the relation if necessary
  457.         if ($profile === null && $this->profile !== null) {
  458.             $this->profile->setUser(null);
  459.         }
  460.         // set the owning side of the relation if necessary
  461.         if ($profile !== null && $profile->getUser() !== $this) {
  462.             $profile->setUser($this);
  463.         }
  464.         $this->profile $profile;
  465.         return $this;
  466.     }
  467.     public function getAccountType(): ?AccountType
  468.     {
  469.         return $this->accountType;
  470.     }
  471.     public function setAccountType(?AccountType $accountType): static
  472.     {
  473.         $this->accountType $accountType;
  474.         return $this;
  475.     }
  476.     /**
  477.      * @return Collection<int, UserDocument>
  478.      */
  479.     public function getDocuments(): Collection
  480.     {
  481.         return $this->documents;
  482.     }
  483.     public function addDocument(UserDocument $document): static
  484.     {
  485.         if (!$this->documents->contains($document)) {
  486.             $this->documents->add($document);
  487.             $document->setUser($this);
  488.         }
  489.         return $this;
  490.     }
  491.     public function removeDocument(UserDocument $document): static
  492.     {
  493.         if ($this->documents->removeElement($document)) {
  494.             // set the owning side to null (unless already changed)
  495.             if ($document->getUser() === $this) {
  496.                 $document->setUser(null);
  497.             }
  498.         }
  499.         return $this;
  500.     }
  501.     /**
  502.      * @return Collection<int, UserHoliday>
  503.      */
  504.     public function getHolidays(): Collection
  505.     {
  506.         return $this->holidays;
  507.     }
  508.     public function addHoliday(UserHoliday $holiday): static
  509.     {
  510.         if (!$this->holidays->contains($holiday)) {
  511.             $this->holidays->add($holiday);
  512.             $holiday->setUser($this);
  513.         }
  514.         return $this;
  515.     }
  516.     public function removeHoliday(UserHoliday $holiday): static
  517.     {
  518.         if ($this->holidays->removeElement($holiday)) {
  519.             // set the owning side to null (unless already changed)
  520.             if ($holiday->getUser() === $this) {
  521.                 $holiday->setUser(null);
  522.             }
  523.         }
  524.         return $this;
  525.     }
  526.     /**
  527.      * @return Collection<int, UserHoliday>
  528.      */
  529.     public function getSubstitutions(): Collection
  530.     {
  531.         return $this->substitutions;
  532.     }
  533.     public function addSubstitution(UserHoliday $substitution): static
  534.     {
  535.         if (!$this->substitutions->contains($substitution)) {
  536.             $this->substitutions->add($substitution);
  537.             $substitution->setSubstitute($this);
  538.         }
  539.         return $this;
  540.     }
  541.     public function removeSubstitution(UserHoliday $substitution): static
  542.     {
  543.         if ($this->substitutions->removeElement($substitution)) {
  544.             // set the owning side to null (unless already changed)
  545.             if ($substitution->getSubstitute() === $this) {
  546.                 $substitution->setSubstitute(null);
  547.             }
  548.         }
  549.         return $this;
  550.     }
  551.     /**
  552.      * @return Collection<int, JoinTableUserWarehouse>
  553.      */
  554.     public function getWarehouses(): Collection
  555.     {
  556.         return $this->warehouses;
  557.     }
  558.     public function addWarehouse(JoinTableUserWarehouse $warehouse): static
  559.     {
  560.         if (!$this->warehouses->contains($warehouse)) {
  561.             $this->warehouses->add($warehouse);
  562.             $warehouse->setUser($this);
  563.         }
  564.         return $this;
  565.     }
  566.     public function removeWarehouse(JoinTableUserWarehouse $warehouse): static
  567.     {
  568.         if ($this->warehouses->removeElement($warehouse)) {
  569.             // set the owning side to null (unless already changed)
  570.             if ($warehouse->getUser() === $this) {
  571.                 $warehouse->setUser(null);
  572.             }
  573.         }
  574.         return $this;
  575.     }
  576.     /**
  577.      * @return Collection<int, TechnicianArea>
  578.      */
  579.     public function getTechnicianAreas(): Collection
  580.     {
  581.         return $this->technicianAreas;
  582.     }
  583.     public function addTechnicianArea(TechnicianArea $technicianArea): static
  584.     {
  585.         if (!$this->technicianAreas->contains($technicianArea)) {
  586.             $this->technicianAreas->add($technicianArea);
  587.             $technicianArea->setUser($this);
  588.         }
  589.         return $this;
  590.     }
  591.     public function removeTechnicianArea(TechnicianArea $technicianArea): static
  592.     {
  593.         if ($this->technicianAreas->removeElement($technicianArea)) {
  594.             // set the owning side to null (unless already changed)
  595.             if ($technicianArea->getUser() === $this) {
  596.                 $technicianArea->setUser(null);
  597.             }
  598.         }
  599.         return $this;
  600.     }
  601.     /**
  602.      * @return Collection<int, JoinTableUserSupplier>
  603.      */
  604.     public function getSuppliers(): Collection
  605.     {
  606.         return $this->suppliers;
  607.     }
  608.     public function addSupplier(JoinTableUserSupplier $supplier): static
  609.     {
  610.         if (!$this->suppliers->contains($supplier)) {
  611.             $this->suppliers->add($supplier);
  612.             $supplier->setUser($this);
  613.         }
  614.         return $this;
  615.     }
  616.     public function removeSupplier(JoinTableUserSupplier $supplier): static
  617.     {
  618.         if ($this->suppliers->removeElement($supplier)) {
  619.             // set the owning side to null (unless already changed)
  620.             if ($supplier->getUser() === $this) {
  621.                 $supplier->setUser(null);
  622.             }
  623.         }
  624.         return $this;
  625.     }
  626.     /**
  627.      * @return Collection<int, ProductTransferLog>
  628.      */
  629.     public function getTransferLogs(): Collection
  630.     {
  631.         return $this->transferLogs;
  632.     }
  633.     public function addTransferLog(ProductTransferLog $transferLog): static
  634.     {
  635.         if (!$this->transferLogs->contains($transferLog)) {
  636.             $this->transferLogs->add($transferLog);
  637.             $transferLog->setUser($this);
  638.         }
  639.         return $this;
  640.     }
  641.     public function removeTransferLog(ProductTransferLog $transferLog): static
  642.     {
  643.         if ($this->transferLogs->removeElement($transferLog)) {
  644.             // set the owning side to null (unless already changed)
  645.             if ($transferLog->getUser() === $this) {
  646.                 $transferLog->setUser(null);
  647.             }
  648.         }
  649.         return $this;
  650.     }
  651.     /**
  652.      * @return Collection<int, ProductTransfer>
  653.      */
  654.     public function getTransfersUserFrom(): Collection
  655.     {
  656.         return $this->transfersUserFrom;
  657.     }
  658.     public function addTransfersUserFrom(ProductTransfer $transfersUserFrom): static
  659.     {
  660.         if (!$this->transfersUserFrom->contains($transfersUserFrom)) {
  661.             $this->transfersUserFrom->add($transfersUserFrom);
  662.             $transfersUserFrom->setUserFrom($this);
  663.         }
  664.         return $this;
  665.     }
  666.     public function removeTransfersUserFrom(ProductTransfer $transfersUserFrom): static
  667.     {
  668.         if ($this->transfersUserFrom->removeElement($transfersUserFrom)) {
  669.             // set the owning side to null (unless already changed)
  670.             if ($transfersUserFrom->getUserFrom() === $this) {
  671.                 $transfersUserFrom->setUserFrom(null);
  672.             }
  673.         }
  674.         return $this;
  675.     }
  676.     /**
  677.      * @return Collection<int, ProductTransfer>
  678.      */
  679.     public function getTransfersUserTo(): Collection
  680.     {
  681.         return $this->transfersUserTo;
  682.     }
  683.     public function addTransfersUserTo(ProductTransfer $transfersUserTo): static
  684.     {
  685.         if (!$this->transfersUserTo->contains($transfersUserTo)) {
  686.             $this->transfersUserTo->add($transfersUserTo);
  687.             $transfersUserTo->setUserTo($this);
  688.         }
  689.         return $this;
  690.     }
  691.     public function removeTransfersUserTo(ProductTransfer $transfersUserTo): static
  692.     {
  693.         if ($this->transfersUserTo->removeElement($transfersUserTo)) {
  694.             // set the owning side to null (unless already changed)
  695.             if ($transfersUserTo->getUserTo() === $this) {
  696.                 $transfersUserTo->setUserTo(null);
  697.             }
  698.         }
  699.         return $this;
  700.     }
  701.     /**
  702.      * @return Collection<int, Ticket>
  703.      */
  704.     public function getTickets(): Collection
  705.     {
  706.         return $this->tickets;
  707.     }
  708.     public function addTicket(Ticket $ticket): static
  709.     {
  710.         if (!$this->tickets->contains($ticket)) {
  711.             $this->tickets->add($ticket);
  712.             $ticket->setTechnician($this);
  713.         }
  714.         return $this;
  715.     }
  716.     public function removeTicket(Ticket $ticket): static
  717.     {
  718.         if ($this->tickets->removeElement($ticket)) {
  719.             // set the owning side to null (unless already changed)
  720.             if ($ticket->getTechnician() === $this) {
  721.                 $ticket->setTechnician(null);
  722.             }
  723.         }
  724.         return $this;
  725.     }
  726.     /**
  727.      * @return Collection<int, Intervention>
  728.      */
  729.     public function getInterventions(): Collection
  730.     {
  731.         return $this->interventions;
  732.     }
  733.     public function addIntervention(Intervention $intervention): static
  734.     {
  735.         if (!$this->interventions->contains($intervention)) {
  736.             $this->interventions->add($intervention);
  737.             $intervention->setTechnician($this);
  738.         }
  739.         return $this;
  740.     }
  741.     public function removeIntervention(Intervention $intervention): static
  742.     {
  743.         if ($this->interventions->removeElement($intervention)) {
  744.             // set the owning side to null (unless already changed)
  745.             if ($intervention->getTechnician() === $this) {
  746.                 $intervention->setTechnician(null);
  747.             }
  748.         }
  749.         return $this;
  750.     }
  751.     /**
  752.      * @return Collection<int, ProductRequest>
  753.      */
  754.     public function getProductRequests(): Collection
  755.     {
  756.         return $this->productRequests;
  757.     }
  758.     public function addProductRequest(ProductRequest $productRequest): static
  759.     {
  760.         if (!$this->productRequests->contains($productRequest)) {
  761.             $this->productRequests->add($productRequest);
  762.             $productRequest->setTechnician($this);
  763.         }
  764.         return $this;
  765.     }
  766.     public function removeProductRequest(ProductRequest $productRequest): static
  767.     {
  768.         if ($this->productRequests->removeElement($productRequest)) {
  769.             // set the owning side to null (unless already changed)
  770.             if ($productRequest->getTechnician() === $this) {
  771.                 $productRequest->setTechnician(null);
  772.             }
  773.         }
  774.         return $this;
  775.     }
  776.     /**
  777.      * @return Collection<int, Intervention>
  778.      */
  779.     public function getOperatorInterventions(): Collection
  780.     {
  781.         return $this->operatorInterventions;
  782.     }
  783.     public function addOperatorIntervention(Intervention $operatorIntervention): static
  784.     {
  785.         if (!$this->operatorInterventions->contains($operatorIntervention)) {
  786.             $this->operatorInterventions->add($operatorIntervention);
  787.             $operatorIntervention->setOperator($this);
  788.         }
  789.         return $this;
  790.     }
  791.     public function removeOperatorIntervention(Intervention $operatorIntervention): static
  792.     {
  793.         if ($this->operatorInterventions->removeElement($operatorIntervention)) {
  794.             // set the owning side to null (unless already changed)
  795.             if ($operatorIntervention->getOperator() === $this) {
  796.                 $operatorIntervention->setOperator(null);
  797.             }
  798.         }
  799.         return $this;
  800.     }
  801.     /**
  802.      * @return Collection<int, Supplier>
  803.      */
  804.     public function getAutoAssignSuppliers(): Collection
  805.     {
  806.         return $this->autoAssignSuppliers;
  807.     }
  808.     public function addAutoAssignSupplier(Supplier $autoAssignSupplier): static
  809.     {
  810.         if (!$this->autoAssignSuppliers->contains($autoAssignSupplier)) {
  811.             $this->autoAssignSuppliers->add($autoAssignSupplier);
  812.         }
  813.         return $this;
  814.     }
  815.     public function removeAutoAssignSupplier(Supplier $autoAssignSupplier): static
  816.     {
  817.         $this->autoAssignSuppliers->removeElement($autoAssignSupplier);
  818.         return $this;
  819.     }
  820.     /**
  821.      * @return Collection<int, TicketReminder>
  822.      */
  823.     public function getReminders(): Collection
  824.     {
  825.         return $this->reminders;
  826.     }
  827.     public function addReminder(TicketReminder $reminder): static
  828.     {
  829.         if (!$this->reminders->contains($reminder)) {
  830.             $this->reminders->add($reminder);
  831.             $reminder->setTechnician($this);
  832.         }
  833.         return $this;
  834.     }
  835.     public function removeReminder(TicketReminder $reminder): static
  836.     {
  837.         if ($this->reminders->removeElement($reminder)) {
  838.             // set the owning side to null (unless already changed)
  839.             if ($reminder->getTechnician() === $this) {
  840.                 $reminder->setTechnician(null);
  841.             }
  842.         }
  843.         return $this;
  844.     }
  845. }