src/Entity/User.php line 67

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