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