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