src/Entity/User.php line 70

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use ApiPlatform\Metadata\ApiFilter;
  6. use ApiPlatform\Metadata\ApiProperty;
  7. use ApiPlatform\Metadata\ApiResource;
  8. use ApiPlatform\Metadata\Delete;
  9. use ApiPlatform\Metadata\Get;
  10. use ApiPlatform\Metadata\GetCollection;
  11. use ApiPlatform\Metadata\Patch;
  12. use ApiPlatform\Metadata\Post;
  13. use ApiPlatform\Metadata\Put;
  14. use Doctrine\DBAL\Types\Types;
  15. use Doctrine\ORM\Mapping as ORM;
  16. use App\Repository\UserRepository;
  17. use App\State\UserPasswordHasher;
  18. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  19. use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
  20. use Symfony\Component\Security\Core\User\UserInterface;
  21. use Symfony\Component\Serializer\Annotation\Groups;
  22. use Symfony\Component\Validator\Constraints as Assert;
  23. use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
  24. use App\Controller\UserController;
  25. use App\Filter\CustomOrFilter// Змініть імпорт на правильний
  26. use ApiPlatform\Doctrine\Orm\Filter\OrderFilter;
  27. // use ApiPlatform\Core\Metadata\Reswource\DeprecationMetadata;
  28. #[ORM\Table(name'users')]
  29. #[ApiResource(
  30.     operations: [
  31.         new GetCollection(),
  32.         new Post(processorUserPasswordHasher::class, validationContext: ['groups' => ['Default''user:create']]),
  33.         new Get(),
  34.         new Put(processorUserPasswordHasher::class),
  35.         new Patch(processorUserPasswordHasher::class),
  36.         new Post(
  37.             name'me'
  38.             uriTemplate'/users/me'
  39.             controllerUserController::class
  40.         ),
  41.         new Delete()
  42.     ],
  43.     normalizationContext: ['groups' => ['user:read']],
  44.     denormalizationContext: ['groups' => ['user:create''user:update']],
  45. )]
  46. #[ORM\Entity(repositoryClassUserRepository::class)]
  47. #[UniqueEntity(fields: ['username'], message'There is already an account with this username')]
  48. #[ApiFilter(CustomOrFilter::class,properties: [
  49.     'username' => 'ipartial'
  50.     'firstName' => 'ipartial'
  51.     'lastName' => 'ipartial',
  52.     'codeUser' => 'exact',
  53.     'codeManager' => 'exact',
  54. ])]
  55. #[ApiFilter(SearchFilter::class, properties: [
  56.     'accounts.manager.id' => 'exact',
  57. ])]
  58. #[ApiFilter(OrderFilter::class, properties: ['loginCount''lastLogin'], arguments: ['orderParameterName' => 'order'])]
  59. class User implements UserInterfacePasswordAuthenticatedUserInterface
  60. {
  61.     #[ORM\Id]
  62.     #[ORM\GeneratedValue]
  63.     #[ORM\Column]
  64.     #[Groups(['user:read''read''account:read''order:read''order_product:read''pre_order_product:read''pre_order:read''load_invoice:read''load_invocie:read''product_storage_balance:read',  'user_docs:read''product:read'])]
  65.     private ?int $id null;
  66.     #[ORM\Column(length180uniquetrue)]
  67.     #[Groups(['user:read''user:create''user:update''read''account:read''user_docs:read'])]
  68.     private ?string $username null;
  69.     #[Groups(['user:read''user:update'])]
  70.     #[ORM\Column]
  71.     private array $roles = [];
  72.     /**
  73.      * @var string The hashed password
  74.      */
  75.     #[ORM\Column]
  76.     private ?string $password null;
  77.     #[Assert\NotBlank(groups: ['user:create'])]
  78.     #[Groups(['user:create''user:update'])]
  79.     private ?string $plainPassword null;
  80.     #[Groups(['user:read''user:create''user:update''read''account:read''account:write''order:read''order_product:read''pre_order_product:read''pre_order:read''load_invoice:read''load_invocie:read''product_storage_balance:read''product:read'])]
  81.     #[ORM\Column(length255nullabletrue)]
  82.     private ?string $firstName  null;
  83.     #[Groups(['user:read''user:create''user:update''read''account:read''account:write''order:read''order_product:read''pre_order_product:read''pre_order:read''load_invoice:read''load_invocie:read''product_storage_balance:read''product:read'])]
  84.     #[ORM\Column(length255nullabletrue)]
  85.     private ?string $lastName null;
  86.     #[Groups(['user:read''user:create''user:update''account:read'])]
  87.     #[ORM\Column(length100nullabletrue)]
  88.     private ?string $phone null;
  89.     #[Groups(['user:read''user:create''user:update'])]
  90.     #[ORM\Column(length255nullabletrue)]
  91.     private ?string $address null
  92.     #[Groups(['user:read''user:create''user:update'])]
  93.     #[ORM\Column(length50nullabletrue)]
  94.     private ?string $status null;
  95.     #[ORM\OneToMany(mappedBy'user'targetEntityUserLikeList::class)]
  96.     private Collection $userLikeLists;
  97.     #[ORM\OneToMany(mappedBy'modified_user'targetEntityProducts::class)]
  98.     private Collection $products;
  99.     #[ORM\OneToMany(mappedBy'created_by'targetEntityProducts::class)]
  100.     private Collection $create_products;
  101.     #[ORM\OneToMany(mappedBy'client'targetEntityOrders::class)]
  102.     private Collection $orders;
  103.     #[ORM\OneToMany(mappedBy'manager'targetEntityOrders::class)]
  104.     private Collection $managerOrders;
  105.     #[Groups(['user:read''user:create''user:update''read''account:read'])]
  106.     #[ORM\Column(length255nullabletrue)]
  107.     private ?string $email null;
  108.     #[Groups(['user:read''user:create''user:update''read'])]
  109.     #[ORM\OneToMany(mappedBy'user'targetEntityAccounts::class)]
  110.     private Collection $accounts;
  111.     #[ORM\OneToMany(mappedBy'client'targetEntityLoadInvoice::class)]
  112.     private Collection $loadInvoices;
  113.     #[ORM\OneToMany(mappedBy'manager'targetEntityAccepted::class)]
  114.     private Collection $acceptedsManager;
  115.  
  116.     #[ORM\OneToMany(mappedBy'client'targetEntityAccepted::class)]
  117.     private Collection $acceptedsClients;
  118.     #[ORM\OneToMany(mappedBy'modified_user'targetEntityAcceptedProduct::class)]
  119.     private Collection $n;
  120.     #[ORM\Column(length20nullabletrue)]
  121.     #[Groups(['user:read''account:read''user:create''user:update''order:read''order_product:read'])]
  122.     private ?string $codeUser null;
  123.     #[ORM\Column(length20nullabletrue)]
  124.     #[Groups(['user:read''account:read''user:create''user:update''order:read''order_product:read'])]
  125.     private ?string $codeManager null;
  126.     #[ORM\OneToMany(mappedBy'manager'targetEntityAccounts::class)]
  127.     private Collection $managerAccounts;
  128.     #[ORM\OneToMany(mappedBy'client'targetEntityPreOrder::class)]
  129.     private Collection $preOrders;
  130.     #[ORM\OneToMany(mappedBy'manager'targetEntityPreOrder::class)]
  131.     private Collection $ManagerPreOrders;
  132.     #[Groups(['user:read''user:create''user:update''read''account:read'])]
  133.     #[ORM\Column(length255nullabletrue)]
  134.     private ?string $workSchedule null;
  135.     #[Groups(['user:read''user:create''user:update''read''account:read'])]
  136.     #[ORM\Column(length255nullabletrue)]
  137.     private ?string $telegram null;
  138.     #[Groups(['user:read''user:create''user:update''read''account:read'])]
  139.     #[ORM\Column(length255nullabletrue)]
  140.     private ?string $viber null;
  141.     #[Groups(['user:read''user:create''user:update''read''account:read'])]
  142.     #[ORM\OneToMany(mappedBy'users'targetEntityMediaObject::class)]
  143.     private Collection $mediaObjects;
  144.     #[ORM\ManyToMany(targetEntityCoupons::class, mappedBy'users')]
  145.     private Collection $coupons;
  146.     #[ORM\OneToMany(mappedBy'users'targetEntityUsersDocs::class)]
  147.     private Collection $usersDocs;
  148.     
  149.     #[ORM\OneToMany(mappedBy'manager'targetEntityProductBalanceInStorage::class)]
  150.     private Collection $productBalanceInStorages;
  151.     #[Groups(['user:read''user:create''user:update'])]
  152.     #[ORM\ManyToOne(inversedBy'users')]
  153.     private ?Location $location null;
  154.     #[ORM\OneToMany(mappedBy'users'targetEntityComments::class)]
  155.     private Collection $comments;
  156.     #[ORM\OneToMany(mappedBy'created_by'targetEntityFaq::class)]
  157.     private Collection $faqs;
  158.     #[ORM\OneToMany(mappedBy'modifiedUser'targetEntityFaq::class)]
  159.     private Collection $modifiedFaq;
  160.     #[Groups(['user:read''user:create''user:update''account:read'])]
  161.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  162.     private ?\DateTimeInterface $lastLogin null;
  163.     #[Groups(['user:read''user:create''user:update''account:read'])]
  164.     #[ORM\Column(nullabletrueoptions: ["default" => 0])]
  165.     private ?int $loginCount null;
  166.     #[ORM\Column(length100nullabletrue)]
  167.     private ?string $actionToken null;
  168.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  169.     private ?\DateTimeInterface $actionTime null;
  170.     public function __construct()
  171.     {
  172.         $this->userLikeLists = new ArrayCollection();
  173.         $this->products = new ArrayCollection();
  174.         $this->create_products = new ArrayCollection();
  175.         $this->orders = new ArrayCollection();
  176.         $this->managerOrders = new ArrayCollection();
  177.         $this->accounts = new ArrayCollection();
  178.         $this->loadInvoices = new ArrayCollection();
  179.         $this->acceptedsManager = new ArrayCollection();
  180.         $this->acceptedsClients = new ArrayCollection();
  181.         $this->= new ArrayCollection();
  182.         $this->managerAccounts = new ArrayCollection();
  183.         $this->preOrders = new ArrayCollection();
  184.         $this->ManagerPreOrders = new ArrayCollection();
  185.         $this->mediaObjects = new ArrayCollection();
  186.         $this->coupons = new ArrayCollection();
  187.         $this->usersDocs = new ArrayCollection();
  188.         $this->productBalanceInStorages = new ArrayCollection();
  189.         $this->comments = new ArrayCollection();
  190.         $this->faqs = new ArrayCollection();
  191.         $this->modifiedFaq = new ArrayCollection();
  192.     }
  193.     public function getId(): ?int
  194.     {
  195.         return $this->id;
  196.     }
  197.     /**
  198.      * @deprecated since Symfony 5.3, use getUserIdentifier instead
  199.      */
  200.     public function getUsername(): string
  201.     {
  202.         return (string) $this->username;
  203.     }
  204.     public function setUsername(string $username): self
  205.     {
  206.         $this->username $username;
  207.         return $this;
  208.     }
  209.     /**
  210.      * A visual identifier that represents this user.
  211.      *
  212.      * @see UserInterface
  213.      */
  214.     public function getUserIdentifier(): string
  215.     {
  216.         return (string) $this->username;
  217.     }
  218.     /**
  219.      * @see UserInterface
  220.      */
  221.     public function getRoles(): array
  222.     {
  223.         $roles $this->roles;
  224.         // guarantee every user at least has ROLE_USER
  225.         $roles[] = 'ROLE_USER';
  226.         return array_unique($roles);
  227.     }
  228.     public function setRoles(array $roles): self
  229.     {
  230.         $this->roles $roles;
  231.         return $this;
  232.     }
  233.     /**
  234.      * @see PasswordAuthenticatedUserInterface
  235.      */
  236.     public function getPassword(): string
  237.     {
  238.         return $this->password;
  239.     }
  240.     public function setPassword(string $password): self
  241.     {
  242.         $this->password $password;
  243.         return $this;
  244.     }
  245.     public function getPlainPassword(): ?string
  246.     {
  247.         return $this->plainPassword;
  248.     }
  249.     public function setPlainPassword(?string $plainPassword): self
  250.     {
  251.         $this->plainPassword $plainPassword;
  252.         return $this;
  253.     }
  254.     /**
  255.      * Returning a salt is only needed, if you are not using a modern
  256.      * hashing algorithm (e.g. bcrypt or sodium) in your security.yaml.
  257.      *
  258.      * @see UserInterface
  259.      */
  260.     public function getSalt(): ?string
  261.     {
  262.         return null;
  263.     }
  264.     /**
  265.      * @see UserInterface
  266.      */
  267.     public function eraseCredentials()
  268.     {
  269.         // If you store any temporary, sensitive data on the user, clear it here
  270.         $this->plainPassword null;
  271.     }
  272.     public function getFirstName(): ?string
  273.     {
  274.         return $this->firstName;
  275.     }
  276.     public function setFirstName(string $firstName): self
  277.     {
  278.         $this->firstName $firstName;
  279.         return $this;
  280.     }
  281.     public function getLastName(): ?string
  282.     {
  283.         return $this->lastName;
  284.     }
  285.     public function setLastName(string $lastName): self
  286.     {
  287.         $this->lastName $lastName;
  288.         return $this;
  289.     }
  290.     public function getPhone(): ?string
  291.     {
  292.         return $this->phone;
  293.     }
  294.     public function setPhone(?string $phone): self
  295.     {
  296.         $this->phone $phone;
  297.         return $this;
  298.     }
  299.     public function getAddress(): ?string
  300.     {
  301.         return $this->address;
  302.     }
  303.     public function setAddress(?string $address): self
  304.     {
  305.         $this->address $address;
  306.         return $this;
  307.     }
  308.     public function getStatus(): ?string
  309.     {
  310.         return $this->status;
  311.     }
  312.     public function setStatus(?string $status): self
  313.     {
  314.         $this->status $status;
  315.         return $this;
  316.     }
  317.     /**
  318.      * @return Collection<int, UserLikeList>
  319.      */
  320.     public function getUserLikeLists(): Collection
  321.     {
  322.         return $this->userLikeLists;
  323.     }
  324.     public function addUserLikeList(UserLikeList $userLikeList): self
  325.     {
  326.         if (!$this->userLikeLists->contains($userLikeList)) {
  327.             $this->userLikeLists->add($userLikeList);
  328.             $userLikeList->setUserId($this);
  329.         }
  330.         return $this;
  331.     }
  332.     public function removeUserLikeList(UserLikeList $userLikeList): self
  333.     {
  334.         if ($this->userLikeLists->removeElement($userLikeList)) {
  335.             // set the owning side to null (unless already changed)
  336.             if ($userLikeList->getUserId() === $this) {
  337.                 $userLikeList->setUserId(null);
  338.             }
  339.         }
  340.         return $this;
  341.     }
  342.     /**
  343.      * @return Collection<int, Products>
  344.      */
  345.     public function getProducts(): Collection
  346.     {
  347.         return $this->products;
  348.     }
  349.     public function addProduct(Products $product): self
  350.     {
  351.         if (!$this->products->contains($product)) {
  352.             $this->products->add($product);
  353.             $product->setModifiedUserId($this);
  354.         }
  355.         return $this;
  356.     }
  357.     // public function removeProduct(Products $product): self
  358.     // {
  359.     //     if ($this->products->removeElement($product)) {
  360.     //         // set the owning side to null (unless already changed)
  361.     //         if ($product->getModifiedUserId() === $this) {
  362.     //             $product->setModifiedUserId(null);
  363.     //         }
  364.     //     }
  365.     //     return $this;
  366.     // }
  367.     /**
  368.      * @return Collection<int, Products>
  369.      */
  370.     public function getCreateProducts(): Collection
  371.     {
  372.         return $this->create_products;
  373.     }
  374.     public function addCreateProduct(Products $createProduct): self
  375.     {
  376.         if (!$this->create_products->contains($createProduct)) {
  377.             $this->create_products->add($createProduct);
  378.             $createProduct->setCreatedBy($this);
  379.         }
  380.         return $this;
  381.     }
  382.     // public function removeCreateProduct(Products $createProduct): self
  383.     // {
  384.     //     if ($this->create_products->removeElement($createProduct)) {
  385.     //         // set the owning side to null (unless already changed)
  386.     //         if ($createProduct->getCreatedBy() === $this) {
  387.     //             $createProduct->setCreatedBy(null);
  388.     //         }
  389.     //     }
  390.     //     return $this;
  391.     // }
  392.     /**
  393.      * @return Collection<int, Orders>
  394.      */
  395.     public function getOrders(): Collection
  396.     {
  397.         return $this->orders;
  398.     }
  399.     public function addOrder(Orders $order): self
  400.     {
  401.         if (!$this->orders->contains($order)) {
  402.             $this->orders->add($order);
  403.             $order->setUserId($this);
  404.         }
  405.         return $this;
  406.     }
  407.     // public function removeOrder(Orders $order): self
  408.     // {
  409.     //     if ($this->orders->removeElement($order)) {
  410.     //         // set the owning side to null (unless already changed)
  411.     //         if ($order->getUserId() === $this) {
  412.     //             $order->setUserId(null);
  413.     //         }
  414.     //     }
  415.     //     return $this;
  416.     // }
  417.     /**
  418.      * @return Collection<int, Orders>
  419.      */
  420.     public function getManagerOrders(): Collection
  421.     {
  422.         return $this->managerOrders;
  423.     }
  424.     public function addManagerOrder(Orders $managerOrder): self
  425.     {
  426.         if (!$this->managerOrders->contains($managerOrder)) {
  427.             $this->managerOrders->add($managerOrder);
  428.             $managerOrder->setManagerId($this);
  429.         }
  430.         return $this;
  431.     }
  432.     // public function removeManagerOrder(Orders $managerOrder): self
  433.     // {
  434.     //     if ($this->managerOrders->removeElement($managerOrder)) {
  435.     //         // set the owning side to null (unless already changed)
  436.     //         if ($managerOrder->getManagerId() === $this) {
  437.     //             $managerOrder->setManagerId(null);
  438.     //         }
  439.     //     }
  440.     //     return $this;
  441.     // }
  442.     public function getEmail(): ?string
  443.     {
  444.         return $this->email;
  445.     }
  446.     public function setEmail(?string $email): self
  447.     {
  448.         $this->email $email;
  449.         return $this;
  450.     }
  451.     /**
  452.      * @return Collection<int, Accounts>
  453.      */
  454.     public function getAccounts(): Collection
  455.     {
  456.         return $this->accounts;
  457.     }
  458.     public function addAccount(Accounts $account): self
  459.     {
  460.         if (!$this->accounts->contains($account)) {
  461.             $this->accounts->add($account);
  462.             $account->setUser($this);
  463.         }
  464.         return $this;
  465.     }
  466.     public function removeAccount(Accounts $account): self
  467.     {
  468.         if ($this->accounts->removeElement($account)) {
  469.             // set the owning side to null (unless already changed)
  470.             if ($account->getUser() === $this) {
  471.                 $account->setUser(null);
  472.             }
  473.         }
  474.         return $this;
  475.     }
  476.     /**
  477.      * @return Collection<int, LoadInvoice>
  478.      */
  479.     public function getLoadInvoices(): Collection
  480.     {
  481.         return $this->loadInvoices;
  482.     }
  483.     public function addLoadInvoice(LoadInvoice $loadInvoice): self
  484.     {
  485.         if (!$this->loadInvoices->contains($loadInvoice)) {
  486.             $this->loadInvoices->add($loadInvoice);
  487.             $loadInvoice->setClient($this);
  488.         }
  489.         return $this;
  490.     }
  491.     public function removeLoadInvoice(LoadInvoice $loadInvoice): self
  492.     {
  493.         if ($this->loadInvoices->removeElement($loadInvoice)) {
  494.             // set the owning side to null (unless already changed)
  495.             if ($loadInvoice->getClient() === $this) {
  496.                 $loadInvoice->setClient(null);
  497.             }
  498.         }
  499.         return $this;
  500.     }
  501.     /**
  502.      * @return Collection<int, Accepted>
  503.      * acceptedsManager
  504.         *acceptedsClients
  505.      */
  506.     public function getAcceptedsManager(): Collection
  507.     {
  508.         return $this->acceptedsManager;
  509.     }
  510.     public function addAcceptedsManager(Accepted $acceptedsManager): self
  511.     {
  512.         if (!$this->acceptedsManager->contains($acceptedsManager)) {
  513.             $this->acceptedsManager->add($acceptedsManager);
  514.             $acceptedsManager->setManager($this);
  515.         }
  516.         return $this;
  517.     }
  518.     public function removeAcceptedsManager(Accepted $acceptedsManager): self
  519.     {
  520.         if ($this->acceptedsManager->removeElement($acceptedsManager)) {
  521.             // set the owning side to null (unless already changed)
  522.             if ($acceptedsManager->getManager() === $this) {
  523.                 $acceptedsManager->setManager(null);
  524.             }
  525.         }
  526.         return $this;
  527.     }
  528.     /**
  529.      * @return Collection<int, Accepted>
  530.      * acceptedsManager
  531.         *acceptedsClients
  532.      */
  533.     public function getAcceptedsClients(): Collection
  534.     {
  535.         return $this->acceptedsClients;
  536.     }
  537.     public function addAcceptedsClients(Accepted $acceptedsClients): self
  538.     {
  539.         if (!$this->acceptedsClients->contains($acceptedsClients)) {
  540.             $this->acceptedsClients->add($acceptedsClients);
  541.             $acceptedsClients->setManager($this);
  542.         }
  543.         return $this;
  544.     }
  545.     public function removeAcceptedsClients(Accepted $acceptedsClients): self
  546.     {
  547.         if ($this->acceptedsClients->removeElement($acceptedsClients)) {
  548.             // set the owning side to null (unless already changed)
  549.             if ($acceptedsClients->getManager() === $this) {
  550.                 $acceptedsClients->setManager(null);
  551.             }
  552.         }
  553.         return $this;
  554.     }
  555.     /**
  556.      * @return Collection<int, AcceptedProduct>
  557.      */
  558.     public function getN(): Collection
  559.     {
  560.         return $this->n;
  561.     }
  562.     public function addN(AcceptedProduct $n): self
  563.     {
  564.         if (!$this->n->contains($n)) {
  565.             $this->n->add($n);
  566.             $n->setModifiedUser($this);
  567.         }
  568.         return $this;
  569.     }
  570.     public function removeN(AcceptedProduct $n): self
  571.     {
  572.         if ($this->n->removeElement($n)) {
  573.             // set the owning side to null (unless already changed)
  574.             if ($n->getModifiedUser() === $this) {
  575.                 $n->setModifiedUser(null);
  576.             }
  577.         }
  578.         return $this;
  579.     }
  580.     public function getCodeUser(): ?string
  581.     {
  582.         return $this->codeUser;
  583.     }
  584.     public function setCodeUser(string $codeUser): self
  585.     {
  586.         $this->codeUser $codeUser;
  587.         return $this;
  588.     }
  589.     public function getCodeManager(): ?string
  590.     {
  591.         return $this->codeManager;
  592.     }
  593.     public function setCodeManager(string $codeManager): self
  594.     {
  595.         $this->codeManager $codeManager;
  596.         return $this;
  597.     }
  598.     /**
  599.      * @return Collection<int, Accounts>
  600.      */
  601.     public function getManagerAccounts(): Collection
  602.     {
  603.         return $this->managerAccounts;
  604.     }
  605.     public function addManagerAccount(Accounts $managerAccount): self
  606.     {
  607.         if (!$this->managerAccounts->contains($managerAccount)) {
  608.             $this->managerAccounts->add($managerAccount);
  609.             $managerAccount->setManager($this);
  610.         }
  611.         return $this;
  612.     }
  613.     public function removeManagerAccount(Accounts $managerAccount): self
  614.     {
  615.         if ($this->managerAccounts->removeElement($managerAccount)) {
  616.             // set the owning side to null (unless already changed)
  617.             if ($managerAccount->getManager() === $this) {
  618.                 $managerAccount->setManager(null);
  619.             }
  620.         }
  621.         return $this;
  622.     }
  623.     /**
  624.      * @return Collection<int, PreOrder>
  625.      */
  626.     public function getPreOrders(): Collection
  627.     {
  628.         return $this->preOrders;
  629.     }
  630.     public function addPreOrder(PreOrder $preOrder): self
  631.     {
  632.         if (!$this->preOrders->contains($preOrder)) {
  633.             $this->preOrders->add($preOrder);
  634.             $preOrder->setClient($this);
  635.         }
  636.         return $this;
  637.     }
  638.     public function removePreOrder(PreOrder $preOrder): self
  639.     {
  640.         if ($this->preOrders->removeElement($preOrder)) {
  641.             // set the owning side to null (unless already changed)
  642.             if ($preOrder->getClient() === $this) {
  643.                 $preOrder->setClient(null);
  644.             }
  645.         }
  646.         return $this;
  647.     }
  648.     /**
  649.      * @return Collection<int, PreOrder>
  650.      */
  651.     public function getManagerPreOrders(): Collection
  652.     {
  653.         return $this->ManagerPreOrders;
  654.     }
  655.     public function addManagerPreOrder(PreOrder $managerPreOrder): self
  656.     {
  657.         if (!$this->ManagerPreOrders->contains($managerPreOrder)) {
  658.             $this->ManagerPreOrders->add($managerPreOrder);
  659.             $managerPreOrder->setManager($this);
  660.         }
  661.         return $this;
  662.     }
  663.     public function removeManagerPreOrder(PreOrder $managerPreOrder): self
  664.     {
  665.         if ($this->ManagerPreOrders->removeElement($managerPreOrder)) {
  666.             // set the owning side to null (unless already changed)
  667.             if ($managerPreOrder->getManager() === $this) {
  668.                 $managerPreOrder->setManager(null);
  669.             }
  670.         }
  671.         return $this;
  672.     }
  673.     public function getWorkSchedule(): ?string
  674.     {
  675.         return $this->workSchedule;
  676.     }
  677.     public function setWorkSchedule(?string $workSchedule): self
  678.     {
  679.         $this->workSchedule $workSchedule;
  680.         return $this;
  681.     }
  682.     public function getTelegram(): ?string
  683.     {
  684.         return $this->telegram;
  685.     }
  686.     public function setTelegram(?string $telegram): self
  687.     {
  688.         $this->telegram $telegram;
  689.         return $this;
  690.     }
  691.     public function getViber(): ?string
  692.     {
  693.         return $this->viber;
  694.     }
  695.     public function setViber(?string $viber): self
  696.     {
  697.         $this->viber $viber;
  698.         return $this;
  699.     }
  700.     /**
  701.      * @return Collection<int, MediaObject>
  702.      */
  703.     public function getMediaObjects(): Collection
  704.     {
  705.         return $this->mediaObjects;
  706.     }
  707.     public function addMediaObject(MediaObject $mediaObject): self
  708.     {
  709.         if (!$this->mediaObjects->contains($mediaObject)) {
  710.             $this->mediaObjects->add($mediaObject);
  711.             $mediaObject->setUsers($this);
  712.         }
  713.         return $this;
  714.     }
  715.     public function removeMediaObject(MediaObject $mediaObject): self
  716.     {
  717.         if ($this->mediaObjects->removeElement($mediaObject)) {
  718.             // set the owning side to null (unless already changed)
  719.             if ($mediaObject->getUsers() === $this) {
  720.                 $mediaObject->setUsers(null);
  721.             }
  722.         }
  723.         return $this;
  724.     }
  725.     /**
  726.      * @return Collection<int, Coupons>
  727.      */
  728.     public function getCoupons(): Collection
  729.     {
  730.         return $this->coupons;
  731.     }
  732.     public function addCoupon(Coupons $coupon): self
  733.     {
  734.         if (!$this->coupons->contains($coupon)) {
  735.             $this->coupons->add($coupon);
  736.             $coupon->addUser($this);
  737.         }
  738.         return $this;
  739.     }
  740.     public function removeCoupon(Coupons $coupon): self
  741.     {
  742.         if ($this->coupons->removeElement($coupon)) {
  743.             $coupon->removeUser($this);
  744.         }
  745.         return $this;
  746.     }
  747.     /**
  748.      * @return Collection<int, UsersDocs>
  749.      */
  750.     public function getUsersDocs(): Collection
  751.     {
  752.         return $this->usersDocs;
  753.     }
  754.     public function addUsersDoc(UsersDocs $usersDoc): static
  755.     {
  756.         if (!$this->usersDocs->contains($usersDoc)) {
  757.             $this->usersDocs->add($usersDoc);
  758.             $usersDoc->setUsers($this);
  759.         }
  760.         return $this;
  761.     }
  762.     
  763.     /**
  764.      * @return Collection<int, ProductBalanceInStorage>
  765.      */
  766.     public function getProductBalanceInStorages(): Collection
  767.     {
  768.         return $this->productBalanceInStorages;
  769.     }
  770.     public function addProductBalanceInStorage(ProductBalanceInStorage $productBalanceInStorage): self
  771.     {
  772.         if (!$this->productBalanceInStorages->contains($productBalanceInStorage)) {
  773.             $this->productBalanceInStorages->add($productBalanceInStorage);
  774.             $productBalanceInStorage->setManager($this);
  775.         }
  776.         return $this;
  777.     }
  778.     public function removeUsersDoc(UsersDocs $usersDoc): static
  779.     {
  780.         if ($this->usersDocs->removeElement($usersDoc)) {
  781.             // set the owning side to null (unless already changed)
  782.             if ($usersDoc->getUsers() === $this) {
  783.                 $usersDoc->setUsers(null);
  784.             }
  785.         }
  786.         return $this;
  787.     }
  788.     public function removeProductBalanceInStorage(ProductBalanceInStorage $productBalanceInStorage): self
  789.     {
  790.         if ($this->productBalanceInStorages->removeElement($productBalanceInStorage)) {
  791.             // set the owning side to null (unless already changed)
  792.             if ($productBalanceInStorage->getManager() === $this) {
  793.                 $productBalanceInStorage->setManager(null);
  794.             }
  795.         }
  796.         return $this;
  797.     }
  798.     public function getLocation(): ?Location
  799.     {
  800.         return $this->location;
  801.     }
  802.     public function setLocation(?Location $location): self
  803.     {
  804.         $this->location $location;
  805.         return $this;
  806.     }
  807.     /**
  808.      * @return Collection<int, Comments>
  809.      */
  810.     public function getComments(): Collection
  811.     {
  812.         return $this->comments;
  813.     }
  814.     public function addComment(Comments $comment): static
  815.     {
  816.         if (!$this->comments->contains($comment)) {
  817.             $this->comments->add($comment);
  818.             $comment->setUsers($this);
  819.         }
  820.         return $this;
  821.     }
  822.     public function removeComment(Comments $comment): static
  823.     {
  824.         if ($this->comments->removeElement($comment)) {
  825.             // set the owning side to null (unless already changed)
  826.             if ($comment->getUsers() === $this) {
  827.                 $comment->setUsers(null);
  828.             }
  829.         }
  830.         return $this;
  831.     }
  832.     /**
  833.      * @return Collection<int, Faq>
  834.      */
  835.     public function getFaqs(): Collection
  836.     {
  837.         return $this->faqs;
  838.     }
  839.     public function addFaq(Faq $faq): static
  840.     {
  841.         if (!$this->faqs->contains($faq)) {
  842.             $this->faqs->add($faq);
  843.             $faq->setCreatedBy($this);
  844.         }
  845.         return $this;
  846.     }
  847.     public function removeFaq(Faq $faq): static
  848.     {
  849.         if ($this->faqs->removeElement($faq)) {
  850.             // set the owning side to null (unless already changed)
  851.             if ($faq->getCreatedBy() === $this) {
  852.                 $faq->setCreatedBy(null);
  853.             }
  854.         }
  855.         return $this;
  856.     }
  857.     /**
  858.      * @return Collection<int, Faq>
  859.      */
  860.     public function getModifiedFaq(): Collection
  861.     {
  862.         return $this->modifiedFaq;
  863.     }
  864.     public function addModifiedFaq(Faq $modifiedFaq): static
  865.     {
  866.         if (!$this->modifiedFaq->contains($modifiedFaq)) {
  867.             $this->modifiedFaq->add($modifiedFaq);
  868.             $modifiedFaq->setModifiedUser($this);
  869.         }
  870.         return $this;
  871.     }
  872.     public function removeModifiedFaq(Faq $modifiedFaq): static
  873.     {
  874.         if ($this->modifiedFaq->removeElement($modifiedFaq)) {
  875.             // set the owning side to null (unless already changed)
  876.             if ($modifiedFaq->getModifiedUser() === $this) {
  877.                 $modifiedFaq->setModifiedUser(null);
  878.             }
  879.         }
  880.         return $this;
  881.     }
  882.     public function getLastLogin(): ?\DateTimeInterface
  883.     {
  884.         return $this->lastLogin;
  885.     }
  886.     public function setLastLogin(?\DateTimeInterface $lastLogin): static
  887.     {
  888.         $this->lastLogin $lastLogin;
  889.         return $this;
  890.     }
  891.     public function getLoginCount(): ?int
  892.     {
  893.         return $this->loginCount;
  894.     }
  895.     public function setLoginCount(?int $loginCount): static
  896.     {
  897.         $this->loginCount $loginCount;
  898.         return $this;
  899.     }
  900.     public function getActionToken(): ?string
  901.     {
  902.         return $this->actionToken;
  903.     }
  904.     public function setActionToken(?string $actionToken): static
  905.     {
  906.         $this->actionToken $actionToken;
  907.         return $this;
  908.     }
  909.     public function getActionTime(): ?\DateTimeInterface
  910.     {
  911.         return $this->actionTime;
  912.     }
  913.     public function setActionTime(?\DateTimeInterface $actionTime): static
  914.     {
  915.         $this->actionTime $actionTime;
  916.         return $this;
  917.     }
  918. }