src/Entity/User.php line 23

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\UserRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\Common\Collections\Criteria;
  7. use Doctrine\Common\Collections\Selectable;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  10. use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
  11. use Symfony\Component\Security\Core\User\UserInterface;
  12. use Symfony\Component\Serializer\Annotation\Groups;
  13. /**
  14.  * @ORM\Entity(repositoryClass=UserRepository::class)
  15.  * @UniqueEntity(
  16.  *       fields={"email"},
  17.  *       message="User already registered|User with combination (%s) is already registered"
  18.  *  )
  19.  */
  20. class User implements UserInterfacePasswordAuthenticatedUserInterface
  21. {
  22.     /**
  23.      * @ORM\Id
  24.      * @ORM\GeneratedValue
  25.      * @ORM\Column(type="integer")
  26.      * @Groups({
  27.      *     "user.core",
  28.      *     "user:core",
  29.      *     "user@base",
  30.      *     "user@core"
  31.      * })
  32.      */
  33.     private $id;
  34.     /**
  35.      * @ORM\Column(type="string", length=180, unique=true)
  36.      * @Groups({
  37.      *     "user.core",
  38.      *     "user:core",
  39.      *     "user@core",
  40.      *     "user@base",
  41.      *     "user@open_api"
  42.      *  })
  43.      */
  44.     private $email;
  45.     /**
  46.      * @ORM\Column(type="json")
  47.      * @Groups({
  48.      *     "user.core",
  49.      *     "user:core",
  50.      *     "user@core",
  51.      *     "user@roles"
  52.      *  })
  53.      */
  54.     private $roles = [];
  55.     /**
  56.      * @var string The hashed password
  57.      * @ORM\Column(type="string")
  58.      */
  59.     private $password;
  60.     /**
  61.      * @var string The hashed password
  62.      * @ORM\Column(type="string", length=64, nullable=true )
  63.      * Groups({"user.core", "user:core", "user@core", "worker.manage.base.timesheet.payments"})
  64.      * @Groups({
  65.      *      "user.core",
  66.      *      "user:core",
  67.      *      "worker.manage.base.timesheet.payments",
  68.      *
  69.      *     "user@base",
  70.      *     "user@core",
  71.      *     "user@open_api"
  72.      *  })
  73.      */
  74.     private $name;
  75.     /**
  76.      * @var string The hashed password
  77.      * @ORM\Column(type="string", length=64, nullable=true )
  78.      * Groups({"user.core", "user:core", "user@core", "worker.manage.base.timesheet.payments"})
  79.      * @Groups({
  80.      *     "user.core",
  81.      *     "user:core",
  82.      *     "worker.manage.base.timesheet.payments",
  83.      *
  84.      *     "user@base",
  85.      *     "user@core",
  86.      *     "user@open_api"
  87.      * })
  88.      */
  89.     private $surname;
  90.     /**
  91.      * Private Prop no column based
  92.      * @var string The hashed password
  93.      * @Groups({
  94.      *     "user.core",
  95.      *     "user:core",
  96.      *
  97.      *     "user@base",
  98.      *     "user@core",
  99.      *     "user@open_api"
  100.      * })
  101.      */
  102.     private $full_name;
  103.     public function getFullName(): string
  104.     {
  105.         return "{$this->getName()} {$this->getSurname()}";
  106.     }
  107.     /**
  108.      * @ORM\OneToMany(targetEntity=ProjectAddendumCosts::class, mappedBy="added_by")
  109.      */
  110.     private $projectAddendumCosts;
  111.     
  112.     /**
  113.      * TODO @deprecated
  114.      * @deprecated use user_rights
  115.      * @ORM\ManyToMany(targetEntity=AccessRoles::class, inversedBy="users")
  116.      * @Groups({
  117.      *     "user.manage",
  118.      *     "user.accessed.roles",
  119.      *
  120.      *     "user@acces_roles"
  121.      * })
  122.      */
  123.     private $user_accessed_roles;
  124.     /**
  125.      * @ORM\OneToMany(targetEntity=WorkerTimesheetPayments::class, mappedBy="payer")
  126.      */
  127.     private $workerTimesheetPayments;
  128.     /**
  129.      * @ORM\OneToMany(targetEntity=ProjectOrderFeedback::class, mappedBy="user")
  130.      */
  131.     private $projectOrderFeedback;
  132.     /**
  133.      * @ORM\OneToMany(targetEntity=ProjectOrders::class, mappedBy="author")
  134.      */
  135.     private $projectOrders;
  136.     /**
  137.      * @ORM\Column(type="boolean", nullable=true)
  138.      * @Groups({
  139.      *     "user.core",
  140.      *     "user:core",
  141.      *     "user@core"
  142.      * })
  143.      */
  144.     private $login_refused;
  145.     /**
  146.      * @ORM\Column(type="string", length=255, nullable=true)
  147.      * @Groups({
  148.      *      "user.core",
  149.      *      "user:core",
  150.      *      "user@core"
  151.      *  })
  152.      */
  153.     private $login_refused_message;
  154.     /**
  155.      * @ORM\Column(type="datetime", nullable=true)
  156.      */
  157.     private $invisible_since;
  158.     /**
  159.      * @ORM\OneToMany(targetEntity=UserModulePermissions::class, mappedBy="user", cascade={"persist", "remove"}, orphanRemoval=true)
  160.      * @Groups({
  161.      *     "user.rights",
  162.      *
  163.      *     "user@rights",
  164.      *
  165.      *
  166.      *     "user@permissions"
  167.      * })
  168.      */
  169.     private $user_module_permissions;
  170.     /**
  171.      * @ORM\OneToMany(targetEntity=Inventory::class, mappedBy="involved_by")
  172.      */
  173.     private $inventories;
  174.     /**
  175.      * @ORM\OneToMany(targetEntity=SupplierOrders::class, mappedBy="order_by")
  176.      */
  177.     private $supplierOrders;
  178.     /**
  179.      * TODO Replace prop with ownership
  180.      * @ORM\OneToMany(targetEntity=UserScopedItem::class, mappedBy="user", cascade={"persist", "remove"}, orphanRemoval=true )
  181.      * @Groups({
  182.      *     "user.scoped.items",
  183.      *     "user@ownerships"
  184.      * })
  185.      */
  186.     private $user_scoped_items;
  187.     /**
  188.      * @deprecated use workerActivity instead
  189.      * @ORM\OneToOne(targetEntity=Worker::class, mappedBy="user", cascade={"persist", "remove"})
  190.      */
  191.     private $worker;
  192.     /**
  193.      * @ORM\OneToMany(targetEntity=UserCalculationPermission::class, mappedBy="user", cascade={"persist", "remove"}, orphanRemoval=true )
  194.      * @Groups({"user.calculate.permissions"})
  195.      */
  196.     private $user_calculation_permissions;
  197.     /**
  198.      * @ORM\Column(type="datetime_immutable", nullable=true)
  199.      * @Groups({
  200.      *     "user.core",
  201.      *     "user:core",
  202.      *     "user@core"
  203.      * })
  204.      */
  205.     private $is_password_updated_at;
  206.     /**
  207.      * @ORM\ManyToOne(targetEntity=UserPositions::class, inversedBy="users")
  208.      * @Groups({
  209.      *     "user.position",
  210.      *
  211.      *     "user@position"
  212.      * })
  213.      */
  214.     private $user_position;
  215.     /**
  216.      * @ORM\Column(type="integer", nullable=true)
  217.      * @Groups({
  218.      *      "user.core",
  219.      *      "user:core",
  220.      *      "user@core"
  221.      *  })
  222.      */
  223.     private $idle_timer_timeout;
  224.     /**
  225.      * @ORM\Column(type="json", nullable=true)
  226.      * @Groups({
  227.      *      "user.core",
  228.      *      "user:core",
  229.      *      "user@core"
  230.      *  })
  231.      */
  232.     private $notification_preferences = [];
  233.     /**
  234.      * @ORM\Column(type="text", nullable=true)
  235.      * @Groups({
  236.      *      "user.core",
  237.      *      "user:core",
  238.      *      "user@core"
  239.      *  })
  240.      */
  241.     private $email_signature;
  242.     /**
  243.      * @ORM\OneToMany(targetEntity=WorkerActivities::class, mappedBy="user")
  244.      * @Groups({
  245.      *     "user.worker.activities",
  246.      *     "user@worker_activities"
  247.      * })
  248.      */
  249.     private $worker_activities;
  250.     /**
  251.      * NO COLUMN BASED
  252.      * @Groups({
  253.      *      "user.as.worker.latest.activity",
  254.      *      "user@latest_activity"
  255.      *  })
  256.      */
  257.     private $user_as_worker_latest_activity;
  258.     /**
  259.      * @ORM\OneToMany(targetEntity=PurchaseRequest::class, mappedBy="requester")
  260.      */
  261.     private $purchase_requests_requester;
  262.     /**
  263.      * @ORM\OneToMany(targetEntity=PurchaseRequest::class, mappedBy="approver")
  264.      */
  265.     private $purchase_requests_approver;
  266.     /**
  267.      * @ORM\OneToMany(targetEntity=PurchaseRequestPositionHistoryRead::class, mappedBy="user")
  268.      */
  269.     private $purchase_request_position_history_reads;
  270.     /**
  271.      * @ORM\OneToMany(targetEntity=PurchaseRequestHistoryRead::class, mappedBy="user")
  272.      */
  273.     private $purchase_request_history_reads;
  274.     /**
  275.      * @ORM\OneToMany(targetEntity=PurchaseRequestHistories::class, mappedBy="owner")
  276.      */
  277.     private $purchaseRequestHistories;
  278.     /**
  279.      * @ORM\OneToMany(targetEntity=PurchaseRequestUserFavorites::class, mappedBy="user")
  280.      */
  281.     private $purchaseRequestUserFavorites;
  282.     /**
  283.      * @ORM\OneToMany(targetEntity=PurchaseRequestPositions::class, mappedBy="approver")
  284.      */
  285.     private $purchase_request_positions_approver;
  286.     /**
  287.      * @ORM\OneToMany(targetEntity=PurchaseRequestPositions::class, mappedBy="rejecter")
  288.      */
  289.     private $purchase_request_positions_rejecter;
  290.     /**
  291.      * @ORM\OneToMany(targetEntity=PurchaseRequest::class, mappedBy="rejecter")
  292.      */
  293.     private $purchase_request_rejecter;
  294.     /**
  295.      * @ORM\OneToMany(targetEntity=Warehouses::class, mappedBy="creator")
  296.      */
  297.     private $warehouses;
  298.     /**
  299.      * @ORM\OneToMany(targetEntity=StockIssue::class, mappedBy="issued_by")
  300.      */
  301.     private $stock_out_issues;
  302.     /**
  303.      * @ORM\OneToMany(targetEntity=StockIssuePositions::class, mappedBy="deliverer")
  304.      */
  305.     private $delivered_stock_issue_positions;
  306.     /**
  307.      * @ORM\OneToMany(targetEntity=ProjectAIReports::class, mappedBy="analyse_by")
  308.      */
  309.     private $project_ai_reports;
  310.     /**
  311.      * @ORM\OneToMany(targetEntity=Invoices::class, mappedBy="adder")
  312.      */
  313.     private $invoices;
  314.     /**
  315.      * @ORM\OneToMany(targetEntity=ProjectOrderBillings::class, mappedBy="adder")
  316.      */
  317.     private $project_order_billings;
  318.     // Custom Virtual Column
  319.      private ?WorkerActivities $latest_activity null;
  320.     /**
  321.      * @return mixed
  322.      */
  323.     public function getUserAsWorkerLatestActivity()
  324.     {
  325.         $criteria Criteria::create();
  326.         // $criteria->where(Criteria::expr()->isNull('exit_at'));
  327.         $criteria->orderBy(['id' => Criteria::ASC]);// ->setMaxResults(1);
  328.         /**@var WorkerActivities $latestActivity*/
  329.         $latestActivity $this->getWorkerActivities()->matching($criteria)->last();
  330.         return $this->latest_activity ?? $latestActivity;
  331.     }
  332.     public function setUserAsWorkerLatestActivity(WorkerActivities $workerActivity): void {
  333.         $this->latest_activity $workerActivity;
  334.     }
  335.     public function __construct()
  336.     {
  337.         $this->projectAddendumCosts = new ArrayCollection();
  338.         $this->user_accessed_roles = new ArrayCollection();
  339.         $this->workerTimesheetPayments = new ArrayCollection();
  340.         $this->projectOrderFeedback = new ArrayCollection();
  341.         $this->projectOrders = new ArrayCollection();
  342.         $this->user_module_permissions = new ArrayCollection();
  343.         $this->inventories = new ArrayCollection();
  344.         $this->supplierOrders = new ArrayCollection();
  345.         $this->user_scoped_items = new ArrayCollection();
  346.         $this->user_calculation_permissions = new ArrayCollection();
  347.         $this->worker_activities = new ArrayCollection();
  348.         $this->purchase_requests_requester = new ArrayCollection();
  349.         $this->purchase_requests_approver = new ArrayCollection();
  350.         $this->purchase_request_position_history_reads = new ArrayCollection();
  351.         $this->purchase_request_history_reads = new ArrayCollection();
  352.         $this->purchaseRequestHistories = new ArrayCollection();
  353.         $this->purchaseRequestUserFavorites = new ArrayCollection();
  354.         $this->purchase_request_positions_approver = new ArrayCollection();
  355.         $this->purchase_request_positions_rejecter = new ArrayCollection();
  356.         $this->purchase_request_rejecter = new ArrayCollection();
  357.         $this->warehouses = new ArrayCollection();
  358.         $this->stock_out_issues = new ArrayCollection();
  359.         $this->delivered_stock_issue_positions = new ArrayCollection();
  360.         $this->project_ai_reports = new ArrayCollection();
  361.         $this->invoices = new ArrayCollection();
  362.         $this->project_order_billings = new ArrayCollection();
  363.     }
  364.     public function getId(): ?int
  365.     {
  366.         return $this->id;
  367.     }
  368.     public function getEmail(): ?string
  369.     {
  370.         return $this->email;
  371.     }
  372.     public function setEmail(string $email): self
  373.     {
  374.         $this->email $email;
  375.         return $this;
  376.     }
  377.     /**
  378.      * A visual identifier that represents this user.
  379.      *
  380.      * @see UserInterface
  381.      */
  382.     public function getUserIdentifier(): string
  383.     {
  384.         return (string) $this->email;
  385.     }
  386.     /**
  387.      * @deprecated since Symfony 5.3, use getUserIdentifier instead
  388.      */
  389.     public function getUsername(): string
  390.     {
  391.         return (string) $this->email;
  392.     }
  393.     /**
  394.      * @see UserInterface
  395.      */
  396.     public function getRoles(): array
  397.     {
  398.         $roles $this->roles;
  399.         // guarantee every user at least has ROLE_USER
  400.         $roles[] = 'ROLE_USER';
  401.         return array_unique($roles);
  402.     }
  403.     public function setRoles(array $roles): self
  404.     {
  405.         $this->roles $roles;
  406.         return $this;
  407.     }
  408.     /**
  409.      * @see PasswordAuthenticatedUserInterface
  410.      */
  411.     public function getPassword(): string
  412.     {
  413.         return $this->password;
  414.     }
  415.     public function setPassword(string $password): self
  416.     {
  417.         $this->password $password;
  418.         return $this;
  419.     }
  420.     public function getName(): ?string
  421.     {
  422.         return $this->name;
  423.     }
  424.     public function setName( ?string $name): self
  425.     {
  426.         $this->name $name;
  427.         return $this;
  428.     }
  429.     public function getSurname(): ?string
  430.     {
  431.         return $this->surname;
  432.     }
  433.     public function setSurname(?string $surname): self
  434.     {
  435.         $this->surname $surname;
  436.         return $this;
  437.     }
  438.     /**
  439.      * Returning a salt is only needed, if you are not using a modern
  440.      * hashing algorithm (e.g. bcrypt or sodium) in your security.yaml.
  441.      *
  442.      * @see UserInterface
  443.      */
  444.     public function getSalt(): ?string
  445.     {
  446.         return null;
  447.     }
  448.     /**
  449.      * @see UserInterface
  450.      */
  451.     public function eraseCredentials()
  452.     {
  453.         // If you store any temporary, sensitive data on the user, clear it here
  454.         // $this->plainPassword = null;
  455.     }
  456.     /**
  457.      * @return Collection<int, ProjectAddendumCosts>
  458.      */
  459.     public function getProjectAddendumCosts(): Collection
  460.     {
  461.         return $this->projectAddendumCosts;
  462.     }
  463.     public function addProjectAddendumCost(ProjectAddendumCosts $projectAddendumCost): self
  464.     {
  465.         if (!$this->projectAddendumCosts->contains($projectAddendumCost)) {
  466.             $this->projectAddendumCosts[] = $projectAddendumCost;
  467.             $projectAddendumCost->setAddedBy($this);
  468.         }
  469.         return $this;
  470.     }
  471.     public function removeProjectAddendumCost(ProjectAddendumCosts $projectAddendumCost): self
  472.     {
  473.         if ($this->projectAddendumCosts->removeElement($projectAddendumCost)) {
  474.             // set the owning side to null (unless already changed)
  475.             if ($projectAddendumCost->getAddedBy() === $this) {
  476.                 $projectAddendumCost->setAddedBy(null);
  477.             }
  478.         }
  479.         return $this;
  480.     }
  481.     /**
  482.      * TODO Check this absolutely
  483.      * @return Collection<int, AccessRoles>
  484.      *     @deprecated use user_rights
  485.      */
  486.     public function getUserAccessedRoles(): Collection
  487.     {
  488.         return $this->user_accessed_roles;
  489.     }
  490.     /**
  491.      * @deprecated use user_rights
  492.     */
  493.     public function addUserAccessedRole(AccessRoles $userAccessedRole): self
  494.     {
  495.         if (!$this->user_accessed_roles->contains($userAccessedRole)) {
  496.             $this->user_accessed_roles[] = $userAccessedRole;
  497.         }
  498.         return $this;
  499.     }
  500.     /**
  501.      * @deprecated use user_rights
  502.     */
  503.     public function removeUserAccessedRole(AccessRoles $userAccessedRole): self
  504.     {
  505.         $this->user_accessed_roles->removeElement($userAccessedRole);
  506.         return $this;
  507.     }
  508.     /**
  509.      * @return Collection<int, WorkerTimesheetPayments>
  510.      */
  511.     public function getWorkerTimesheetPayments(): Collection
  512.     {
  513.         return $this->workerTimesheetPayments;
  514.     }
  515.     public function addWorkerTimesheetPayment(WorkerTimesheetPayments $workerTimesheetPayment): self
  516.     {
  517.         if (!$this->workerTimesheetPayments->contains($workerTimesheetPayment)) {
  518.             $this->workerTimesheetPayments[] = $workerTimesheetPayment;
  519.             $workerTimesheetPayment->setPayer($this);
  520.         }
  521.         return $this;
  522.     }
  523.     public function removeWorkerTimesheetPayment(WorkerTimesheetPayments $workerTimesheetPayment): self
  524.     {
  525.         if ($this->workerTimesheetPayments->removeElement($workerTimesheetPayment)) {
  526.             // set the owning side to null (unless already changed)
  527.             if ($workerTimesheetPayment->getPayer() === $this) {
  528.                 $workerTimesheetPayment->setPayer(null);
  529.             }
  530.         }
  531.         return $this;
  532.     }
  533.     /**
  534.      * @return Collection<int, ProjectOrderFeedback>
  535.      */
  536.     public function getProjectOrderFeedback(): Collection
  537.     {
  538.         return $this->projectOrderFeedback;
  539.     }
  540.     public function addProjectOrderFeedback(ProjectOrderFeedback $projectOrderFeedback): self
  541.     {
  542.         if (!$this->projectOrderFeedback->contains($projectOrderFeedback)) {
  543.             $this->projectOrderFeedback[] = $projectOrderFeedback;
  544.             $projectOrderFeedback->setUser($this);
  545.         }
  546.         return $this;
  547.     }
  548.     public function removeProjectOrderFeedback(ProjectOrderFeedback $projectOrderFeedback): self
  549.     {
  550.         if ($this->projectOrderFeedback->removeElement($projectOrderFeedback)) {
  551.             // set the owning side to null (unless already changed)
  552.             if ($projectOrderFeedback->getUser() === $this) {
  553.                 $projectOrderFeedback->setUser(null);
  554.             }
  555.         }
  556.         return $this;
  557.     }
  558.     /**
  559.      * @return Collection<int, ProjectOrders>
  560.      */
  561.     public function getProjectOrders(): Collection
  562.     {
  563.         return $this->projectOrders;
  564.     }
  565.     public function addProjectOrder(ProjectOrders $projectOrder): self
  566.     {
  567.         if (!$this->projectOrders->contains($projectOrder)) {
  568.             $this->projectOrders[] = $projectOrder;
  569.             $projectOrder->setAuthor($this);
  570.         }
  571.         return $this;
  572.     }
  573.     public function removeProjectOrder(ProjectOrders $projectOrder): self
  574.     {
  575.         if ($this->projectOrders->removeElement($projectOrder)) {
  576.             // set the owning side to null (unless already changed)
  577.             if ($projectOrder->getAuthor() === $this) {
  578.                 $projectOrder->setAuthor(null);
  579.             }
  580.         }
  581.         return $this;
  582.     }
  583.     public function isLoginRefused(): ?bool
  584.     {
  585.         return $this->login_refused;
  586.     }
  587.     public function setLoginRefused(?bool $login_refused): self
  588.     {
  589.         $this->login_refused $login_refused;
  590.         return $this;
  591.     }
  592.     public function getLoginRefusedMessage(): ?string
  593.     {
  594.         return $this->login_refused_message;
  595.     }
  596.     public function setLoginRefusedMessage(?string $login_refused_message): self
  597.     {
  598.         $this->login_refused_message $login_refused_message;
  599.         return $this;
  600.     }
  601.     public function getInvisibleSince(): ?\DateTimeInterface
  602.     {
  603.         return $this->invisible_since;
  604.     }
  605.     public function setInvisibleSince(?\DateTimeInterface $invisible_since): self
  606.     {
  607.         $this->invisible_since $invisible_since;
  608.         return $this;
  609.     }
  610.     /**
  611.      * @return Collection<int, UserModulePermissions>&Selectable
  612.      */
  613.     public function getUserModulePermissions(): Collection
  614.     {
  615.         return $this->user_module_permissions;
  616.     }
  617.     public function addUserModulePermission(UserModulePermissions $userModulePermission): self
  618.     {
  619.         if (!$this->user_module_permissions->contains($userModulePermission)) {
  620.             $this->user_module_permissions[] = $userModulePermission;
  621.             $userModulePermission->setUser($this);
  622.         }
  623.         return $this;
  624.     }
  625.     public function removeUserModulePermission(UserModulePermissions $userModulePermission): self
  626.     {
  627.         if ($this->user_module_permissions->removeElement($userModulePermission)) {
  628.             // set the owning side to null (unless already changed)
  629.             if ($userModulePermission->getUser() === $this) {
  630.                 $userModulePermission->setUser(null);
  631.             }
  632.         }
  633.         return $this;
  634.     }
  635.     /**
  636.      * @return Collection<int, Inventory>
  637.      */
  638.     public function getInventories(): Collection
  639.     {
  640.         return $this->inventories;
  641.     }
  642.     public function addInventory(Inventory $inventory): self
  643.     {
  644.         if (!$this->inventories->contains($inventory)) {
  645.             $this->inventories[] = $inventory;
  646.             $inventory->setInvolvedBy($this);
  647.         }
  648.         return $this;
  649.     }
  650.     public function removeInventory(Inventory $inventory): self
  651.     {
  652.         if ($this->inventories->removeElement($inventory)) {
  653.             // set the owning side to null (unless already changed)
  654.             if ($inventory->getInvolvedBy() === $this) {
  655.                 $inventory->setInvolvedBy(null);
  656.             }
  657.         }
  658.         return $this;
  659.     }
  660.     /**
  661.      * @return Collection<int, SupplierOrders>
  662.      */
  663.     public function getSupplierOrders(): Collection
  664.     {
  665.         return $this->supplierOrders;
  666.     }
  667.     public function addSupplierOrder(SupplierOrders $supplierOrder): self
  668.     {
  669.         if (!$this->supplierOrders->contains($supplierOrder)) {
  670.             $this->supplierOrders[] = $supplierOrder;
  671.             $supplierOrder->setOrderBy($this);
  672.         }
  673.         return $this;
  674.     }
  675.     public function removeSupplierOrder(SupplierOrders $supplierOrder): self
  676.     {
  677.         if ($this->supplierOrders->removeElement($supplierOrder)) {
  678.             // set the owning side to null (unless already changed)
  679.             if ($supplierOrder->getOrderBy() === $this) {
  680.                 $supplierOrder->setOrderBy(null);
  681.             }
  682.         }
  683.         return $this;
  684.     }
  685.     /**
  686.      * @return Collection<int, UserScopedItem>
  687.      */
  688.     public function getUserScopedItems(): Collection
  689.     {
  690.         return $this->user_scoped_items;
  691.     }
  692.     public function addUserScopedItems(UserScopedItem $userScopedItem): self
  693.     {
  694.         if (!$this->user_scoped_items->contains($userScopedItem)) {
  695.             $this->user_scoped_items[] = $userScopedItem;
  696.             $userScopedItem->setUser($this);
  697.         }
  698.         return $this;
  699.     }
  700.     public function removeUserScopedItems(UserScopedItem $userScopedItem): self
  701.     {
  702.         if ($this->user_scoped_items->removeElement($userScopedItem)) {
  703.             // set the owning side to null (unless already changed)
  704.             if ($userScopedItem->getUser() === $this) {
  705.                 $userScopedItem->setUser(null);
  706.             }
  707.         }
  708.         return $this;
  709.     }
  710.     public function getWorker(): ?Worker
  711.     {
  712.         return $this->worker;
  713.     }
  714.     public function setWorker(?Worker $worker): self
  715.     {
  716.         // unset the owning side of the relation if necessary
  717.         if ($worker === null && $this->worker !== null) {
  718.             $this->worker->setUser(null);
  719.         }
  720.         // set the owning side of the relation if necessary
  721.         if ($worker !== null && $worker->getUser() !== $this) {
  722.             $worker->setUser($this);
  723.         }
  724.         $this->worker $worker;
  725.         return $this;
  726.     }
  727.     /**
  728.      * @return Collection<int, UserCalculationPermission>
  729.      */
  730.     public function getUserCalculationPermissions(): Collection
  731.     {
  732.         return $this->user_calculation_permissions;
  733.     }
  734.     public function addUserCalculationPermission(UserCalculationPermission $userCalculationPermission): self
  735.     {
  736.         if (!$this->user_calculation_permissions->contains($userCalculationPermission)) {
  737.             $this->user_calculation_permissions[] = $userCalculationPermission;
  738.             $userCalculationPermission->setUser($this);
  739.         }
  740.         return $this;
  741.     }
  742.     public function removeUserCalculationPermission(UserCalculationPermission $userCalculationPermission): self
  743.     {
  744.         if ($this->user_calculation_permissions->removeElement($userCalculationPermission)) {
  745.             // set the owning side to null (unless already changed)
  746.             if ($userCalculationPermission->getUser() === $this) {
  747.                 $userCalculationPermission->setUser(null);
  748.             }
  749.         }
  750.         return $this;
  751.     }
  752.     public function getIsPasswordUpdatedAt(): ?\DateTimeImmutable
  753.     {
  754.         return $this->is_password_updated_at;
  755.     }
  756.     public function setIsPasswordUpdatedAt(?\DateTimeImmutable $is_password_updated_at): self
  757.     {
  758.         $this->is_password_updated_at $is_password_updated_at;
  759.         return $this;
  760.     }
  761.     public function getUserPosition(): ?UserPositions
  762.     {
  763.         return $this->user_position;
  764.     }
  765.     public function setUserPosition(?UserPositions $user_position): self
  766.     {
  767.         $this->user_position $user_position;
  768.         return $this;
  769.     }
  770.     public function getIdleTimerTimeout(): ?int
  771.     {
  772.         return $this->idle_timer_timeout;
  773.     }
  774.     public function setIdleTimerTimeout(?int $idle_timer_timeout): self
  775.     {
  776.         $this->idle_timer_timeout $idle_timer_timeout;
  777.         return $this;
  778.     }
  779.     public function getNotificationPreferences(): ?array
  780.     {
  781.         return $this->notification_preferences;
  782.     }
  783.     public function setNotificationPreferences(?array $notification_preferences): self
  784.     {
  785.         $this->notification_preferences $notification_preferences;
  786.         return $this;
  787.     }
  788.     public function getEmailSignature(): ?string
  789.     {
  790.         return $this->email_signature;
  791.     }
  792.     public function setEmailSignature(?string $email_signature): self
  793.     {
  794.         $this->email_signature $email_signature;
  795.         return $this;
  796.     }
  797.     /**
  798.      * @return Collection<int, WorkerActivities>
  799.      */
  800.     public function getWorkerActivities(): Collection
  801.     {
  802.         return $this->worker_activities;
  803.     }
  804.     public function addWorkerActivity(WorkerActivities $workerActivity): self
  805.     {
  806.         if (!$this->worker_activities->contains($workerActivity)) {
  807.             $this->worker_activities[] = $workerActivity;
  808.             $workerActivity->setUser($this);
  809.         }
  810.         return $this;
  811.     }
  812.     public function removeWorkerActivity(WorkerActivities $workerActivity): self
  813.     {
  814.         if ($this->worker_activities->removeElement($workerActivity)) {
  815.             // set the owning side to null (unless already changed)
  816.             if ($workerActivity->getUser() === $this) {
  817.                 $workerActivity->setUser(null);
  818.             }
  819.         }
  820.         return $this;
  821.     }
  822.     /**
  823.      * @return Collection<int, PurchaseRequest>
  824.      */
  825.     public function getPurchaseRequestsRequester(): Collection
  826.     {
  827.         return $this->purchase_requests_requester;
  828.     }
  829.     public function addPurchaseRequestForRequester(PurchaseRequest $purchaseRequest): self
  830.     {
  831.         if (!$this->purchase_requests_requester->contains($purchaseRequest)) {
  832.             $this->purchase_requests_requester[] = $purchaseRequest;
  833.             $purchaseRequest->setRequester($this);
  834.         }
  835.         return $this;
  836.     }
  837.     public function removePurchaseRequestFromRequester(PurchaseRequest $purchaseRequest): self
  838.     {
  839.         if ($this->purchase_requests_requester->removeElement($purchaseRequest)) {
  840.             // set the owning side to null (unless already changed)
  841.             if ($purchaseRequest->getRequester() === $this) {
  842.                 $purchaseRequest->setRequester(null);
  843.             }
  844.         }
  845.         return $this;
  846.     }
  847.     /**
  848.      * @return Collection<int, PurchaseRequest>
  849.      */
  850.     public function getPurchaseRequestsApprover(): Collection
  851.     {
  852.         return $this->purchase_requests_approver;
  853.     }
  854.     public function addPurchaseRequestForApprover(PurchaseRequest $purchaseRequest): self
  855.     {
  856.         if (!$this->purchase_requests_approver->contains($purchaseRequest)) {
  857.             $this->purchase_requests_approver[] = $purchaseRequest;
  858.             $purchaseRequest->setApprover($this);
  859.         }
  860.         return $this;
  861.     }
  862.     public function removePurchaseRequestFromApprover(PurchaseRequest $purchaseRequest): self
  863.     {
  864.         if ($this->purchase_requests_approver->removeElement($purchaseRequest)) {
  865.             // set the owning side to null (unless already changed)
  866.             if ($purchaseRequest->getApprover() === $this) {
  867.                 $purchaseRequest->setApprover(null);
  868.             }
  869.         }
  870.         return $this;
  871.     }
  872.     /**
  873.      * @return Collection<int, PurchaseRequestPositionHistoryRead>
  874.      */
  875.     public function getPositionPurchaseRequestPositionHistoryReads(): Collection
  876.     {
  877.         return $this->purchase_request_position_history_reads;
  878.     }
  879.     public function addPurchaseRequestHistoryRead(PurchaseRequestPositionHistoryRead $purchaseRequestPositionHistoryRead): self
  880.     {
  881.         if (!$this->purchase_request_position_history_reads->contains($purchaseRequestPositionHistoryRead)) {
  882.             $this->purchase_request_position_history_reads[] = $purchaseRequestPositionHistoryRead;
  883.             $purchaseRequestPositionHistoryRead->setUser($this);
  884.         }
  885.         return $this;
  886.     }
  887.     public function removePurchaseRequestHistoryRead(PurchaseRequestPositionHistoryRead $purchaseRequestPositionHistoryRead): self
  888.     {
  889.         if ($this->purchase_request_position_history_reads->removeElement($purchaseRequestPositionHistoryRead)) {
  890.             // set the owning side to null (unless already changed)
  891.             if ($purchaseRequestPositionHistoryRead->getUser() === $this) {
  892.                 $purchaseRequestPositionHistoryRead->setUser(null);
  893.             }
  894.         }
  895.         return $this;
  896.     }
  897.     /**
  898.      * @return Collection<int, PurchaseRequestHistoryRead>
  899.      */
  900.     public function getPurchaseRequestHistoryReads(): Collection
  901.     {
  902.         return $this->purchase_request_history_reads;
  903.     }
  904.     /**
  905.      * @return Collection<int, PurchaseRequestHistories>
  906.      */
  907.     public function getPurchaseRequestHistories(): Collection
  908.     {
  909.         return $this->purchaseRequestHistories;
  910.     }
  911.     public function addPurchaseRequestHistory(PurchaseRequestHistories $purchaseRequestHistory): self
  912.     {
  913.         if (!$this->purchaseRequestHistories->contains($purchaseRequestHistory)) {
  914.             $this->purchaseRequestHistories[] = $purchaseRequestHistory;
  915.             $purchaseRequestHistory->setOwner($this);
  916.         }
  917.         return $this;
  918.     }
  919.     public function removePurchaseRequestHistory(PurchaseRequestHistories $purchaseRequestHistory): self
  920.     {
  921.         if ($this->purchaseRequestHistories->removeElement($purchaseRequestHistory)) {
  922.             // set the owning side to null (unless already changed)
  923.             if ($purchaseRequestHistory->getOwner() === $this) {
  924.                 $purchaseRequestHistory->setOwner(null);
  925.             }
  926.         }
  927.         return $this;
  928.     }
  929.     /**
  930.      * @return Collection<int, PurchaseRequestUserFavorites>
  931.      */
  932.     public function getPurchaseRequestUserFavorites(): Collection
  933.     {
  934.         return $this->purchaseRequestUserFavorites;
  935.     }
  936.     public function addPurchaseRequestUserFavorite(PurchaseRequestUserFavorites $purchaseRequestUserFavorite): self
  937.     {
  938.         if (!$this->purchaseRequestUserFavorites->contains($purchaseRequestUserFavorite)) {
  939.             $this->purchaseRequestUserFavorites[] = $purchaseRequestUserFavorite;
  940.             $purchaseRequestUserFavorite->setUser($this);
  941.         }
  942.         return $this;
  943.     }
  944.     public function removePurchaseRequestUserFavorite(PurchaseRequestUserFavorites $purchaseRequestUserFavorite): self
  945.     {
  946.         if ($this->purchaseRequestUserFavorites->removeElement($purchaseRequestUserFavorite)) {
  947.             // set the owning side to null (unless already changed)
  948.             if ($purchaseRequestUserFavorite->getUser() === $this) {
  949.                 $purchaseRequestUserFavorite->setUser(null);
  950.             }
  951.         }
  952.         return $this;
  953.     }
  954.     /**
  955.      * @return Collection<int, PurchaseRequestPositions>
  956.      */
  957.     public function getPurchaseRequestPositionsApprover(): Collection
  958.     {
  959.         return $this->purchase_request_positions_approver;
  960.     }
  961.     public function addPurchaseRequestPositionsApprover(PurchaseRequestPositions $purchaseRequestPositionsApprover): self
  962.     {
  963.         if (!$this->purchase_request_positions_approver->contains($purchaseRequestPositionsApprover)) {
  964.             $this->purchase_request_positions_approver[] = $purchaseRequestPositionsApprover;
  965.             $purchaseRequestPositionsApprover->setApprover($this);
  966.         }
  967.         return $this;
  968.     }
  969.     public function removePurchaseRequestPositionsApprover(PurchaseRequestPositions $purchaseRequestPositionsApprover): self
  970.     {
  971.         if ($this->purchase_request_positions_approver->removeElement($purchaseRequestPositionsApprover)) {
  972.             // set the owning side to null (unless already changed)
  973.             if ($purchaseRequestPositionsApprover->getApprover() === $this) {
  974.                 $purchaseRequestPositionsApprover->setApprover(null);
  975.             }
  976.         }
  977.         return $this;
  978.     }
  979.     /**
  980.      * @return Collection<int, PurchaseRequestPositions>
  981.      */
  982.     public function getPurchaseRequestPositionsRejecter(): Collection
  983.     {
  984.         return $this->purchase_request_positions_rejecter;
  985.     }
  986.     public function addPurchaseRequestPositionsRejecter(PurchaseRequestPositions $purchaseRequestPositionsRejecter): self
  987.     {
  988.         if (!$this->purchase_request_positions_rejecter->contains($purchaseRequestPositionsRejecter)) {
  989.             $this->purchase_request_positions_rejecter[] = $purchaseRequestPositionsRejecter;
  990.             $purchaseRequestPositionsRejecter->setRejecter($this);
  991.         }
  992.         return $this;
  993.     }
  994.     public function removePurchaseRequestPositionsRejecter(PurchaseRequestPositions $purchaseRequestPositionsRejecter): self
  995.     {
  996.         if ($this->purchase_request_positions_rejecter->removeElement($purchaseRequestPositionsRejecter)) {
  997.             // set the owning side to null (unless already changed)
  998.             if ($purchaseRequestPositionsRejecter->getRejecter() === $this) {
  999.                 $purchaseRequestPositionsRejecter->setRejecter(null);
  1000.             }
  1001.         }
  1002.         return $this;
  1003.     }
  1004.     /**
  1005.      * @return Collection<int, PurchaseRequest>
  1006.      */
  1007.     public function getPurchaseRequestRejecter(): Collection
  1008.     {
  1009.         return $this->purchase_request_rejecter;
  1010.     }
  1011.     public function addPurchaseRequestRejecter(PurchaseRequest $purchaseRequestRejecter): self
  1012.     {
  1013.         if (!$this->purchase_request_rejecter->contains($purchaseRequestRejecter)) {
  1014.             $this->purchase_request_rejecter[] = $purchaseRequestRejecter;
  1015.             $purchaseRequestRejecter->setRejecter($this);
  1016.         }
  1017.         return $this;
  1018.     }
  1019.     public function removePurchaseRequestRejecter(PurchaseRequest $purchaseRequestRejecter): self
  1020.     {
  1021.         if ($this->purchase_request_rejecter->removeElement($purchaseRequestRejecter)) {
  1022.             // set the owning side to null (unless already changed)
  1023.             if ($purchaseRequestRejecter->getRejecter() === $this) {
  1024.                 $purchaseRequestRejecter->setRejecter(null);
  1025.             }
  1026.         }
  1027.         return $this;
  1028.     }
  1029.     /**
  1030.      * @return Collection<int, Warehouses>
  1031.      */
  1032.     public function getWarehouses(): Collection
  1033.     {
  1034.         return $this->warehouses;
  1035.     }
  1036.     public function addWarehouse(Warehouses $warehouse): self
  1037.     {
  1038.         if (!$this->warehouses->contains($warehouse)) {
  1039.             $this->warehouses[] = $warehouse;
  1040.             $warehouse->setCreator($this);
  1041.         }
  1042.         return $this;
  1043.     }
  1044.     public function removeWarehouse(Warehouses $warehouse): self
  1045.     {
  1046.         if ($this->warehouses->removeElement($warehouse)) {
  1047.             // set the owning side to null (unless already changed)
  1048.             if ($warehouse->getCreator() === $this) {
  1049.                 $warehouse->setCreator(null);
  1050.             }
  1051.         }
  1052.         return $this;
  1053.     }
  1054.     /**
  1055.      * @return Collection<int, StockIssue>
  1056.      */
  1057.     public function getStockOutIssues(): Collection
  1058.     {
  1059.         return $this->stock_out_issues;
  1060.     }
  1061.     public function addStockOutIssue(StockIssue $stockOutIssue): self
  1062.     {
  1063.         if (!$this->stock_out_issues->contains($stockOutIssue)) {
  1064.             $this->stock_out_issues[] = $stockOutIssue;
  1065.             $stockOutIssue->setIssuedBy($this);
  1066.         }
  1067.         return $this;
  1068.     }
  1069.     public function removeStockOutIssue(StockIssue $stockOutIssue): self
  1070.     {
  1071.         if ($this->stock_out_issues->removeElement($stockOutIssue)) {
  1072.             // set the owning side to null (unless already changed)
  1073.             if ($stockOutIssue->getIssuedBy() === $this) {
  1074.                 $stockOutIssue->setIssuedBy(null);
  1075.             }
  1076.         }
  1077.         return $this;
  1078.     }
  1079.     /**
  1080.      * @return Collection<int, StockIssuePositions>
  1081.      */
  1082.     public function getDeliveredStockIssuePositions(): Collection
  1083.     {
  1084.         return $this->delivered_stock_issue_positions;
  1085.     }
  1086.     public function addDeliveredStockIssuePosition(StockIssuePositions $deliveredStockIssuePosition): self
  1087.     {
  1088.         if (!$this->delivered_stock_issue_positions->contains($deliveredStockIssuePosition)) {
  1089.             $this->delivered_stock_issue_positions[] = $deliveredStockIssuePosition;
  1090.             $deliveredStockIssuePosition->setDeliverer($this);
  1091.         }
  1092.         return $this;
  1093.     }
  1094.     public function removeDeliveredStockIssuePosition(StockIssuePositions $deliveredStockIssuePosition): self
  1095.     {
  1096.         if ($this->delivered_stock_issue_positions->removeElement($deliveredStockIssuePosition)) {
  1097.             // set the owning side to null (unless already changed)
  1098.             if ($deliveredStockIssuePosition->getDeliverer() === $this) {
  1099.                 $deliveredStockIssuePosition->setDeliverer(null);
  1100.             }
  1101.         }
  1102.         return $this;
  1103.     }
  1104.     /**
  1105.      * @return Collection<int, ProjectAIReports>
  1106.      */
  1107.     public function getProjectAiReports(): Collection
  1108.     {
  1109.         return $this->project_ai_reports;
  1110.     }
  1111.     public function addProjectAiReport(ProjectAIReports $projectAiReport): self
  1112.     {
  1113.         if (!$this->project_ai_reports->contains($projectAiReport)) {
  1114.             $this->project_ai_reports[] = $projectAiReport;
  1115.             $projectAiReport->setAnalyseBy($this);
  1116.         }
  1117.         return $this;
  1118.     }
  1119.     public function removeProjectAiReport(ProjectAIReports $projectAiReport): self
  1120.     {
  1121.         if ($this->project_ai_reports->removeElement($projectAiReport)) {
  1122.             // set the owning side to null (unless already changed)
  1123.             if ($projectAiReport->getAnalyseBy() === $this) {
  1124.                 $projectAiReport->setAnalyseBy(null);
  1125.             }
  1126.         }
  1127.         return $this;
  1128.     }
  1129.     /**
  1130.      * @return Collection<int, Invoices>
  1131.      */
  1132.     public function getInvoices(): Collection
  1133.     {
  1134.         return $this->invoices;
  1135.     }
  1136.     public function addInvoice(Invoices $invoice): self
  1137.     {
  1138.         if (!$this->invoices->contains($invoice)) {
  1139.             $this->invoices[] = $invoice;
  1140.             $invoice->setAdder($this);
  1141.         }
  1142.         return $this;
  1143.     }
  1144.     public function removeInvoice(Invoices $invoice): self
  1145.     {
  1146.         if ($this->invoices->removeElement($invoice)) {
  1147.             // set the owning side to null (unless already changed)
  1148.             if ($invoice->getAdder() === $this) {
  1149.                 $invoice->setAdder(null);
  1150.             }
  1151.         }
  1152.         return $this;
  1153.     }
  1154.     /**
  1155.      * @return Collection<int, ProjectOrderBillings>
  1156.      */
  1157.     public function getProjectOrderBillings(): Collection
  1158.     {
  1159.         return $this->project_order_billings;
  1160.     }
  1161.     public function addProjectOrderBilling(ProjectOrderBillings $projectOrderBilling): self
  1162.     {
  1163.         if (!$this->project_order_billings->contains($projectOrderBilling)) {
  1164.             $this->project_order_billings[] = $projectOrderBilling;
  1165.             $projectOrderBilling->setAdder($this);
  1166.         }
  1167.         return $this;
  1168.     }
  1169.     public function removeProjectOrderBilling(ProjectOrderBillings $projectOrderBilling): self
  1170.     {
  1171.         if ($this->project_order_billings->removeElement($projectOrderBilling)) {
  1172.             // set the owning side to null (unless already changed)
  1173.             if ($projectOrderBilling->getAdder() === $this) {
  1174.                 $projectOrderBilling->setAdder(null);
  1175.             }
  1176.         }
  1177.         return $this;
  1178.     }
  1179. }