src/Entity/Generic/User.php line 32

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Generic;
  3. use App\Entity\BaseEntity;
  4. use App\Entity\Campaign;
  5. use App\Entity\Domains\Domain;
  6. use App\Entity\Idea;
  7. use App\Entity\Server\Hetzner\Ip;
  8. use App\Entity\Server\Hetzner\Server;
  9. use App\Entity\SubTransactions\ArzDigital;
  10. use App\Entity\Telegram\AgentPublicBot\Bot;
  11. use App\Entity\Transaction;
  12. use App\Entity\VPN\Service\Service;
  13. use App\Repository\Generic\UserRepository;
  14. use DateTimeInterface;
  15. use Doctrine\Common\Collections\ArrayCollection;
  16. use Doctrine\Common\Collections\Collection;
  17. use Doctrine\DBAL\Types\Types;
  18. use Doctrine\ORM\Mapping as ORM;
  19. use JetBrains\PhpStorm\Pure;
  20. use Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator;
  21. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  22. use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
  23. use Symfony\Component\Security\Core\User\UserInterface;
  24. use Symfony\Component\Validator\Constraints as Assert;
  25. #[ORM\Entity(repositoryClassUserRepository::class)]
  26. #[ORM\Table(name'`user`')]
  27. #[UniqueEntity(fields: ['email'], message'این پست الکترونیک از قبل موجود می باشد')]
  28. #[UniqueEntity(fields: ['mobile'], message'این شماره موبایل از قبل موجود می باشد')]
  29. class User extends BaseEntity implements UserInterfacePasswordAuthenticatedUserInterface
  30. {
  31.     #[ORM\Id]
  32.     #[ORM\Column(type'guid'uniquetrue)]
  33.     #[ORM\GeneratedValue(strategy'CUSTOM')]
  34.     #[ORM\CustomIdGenerator(class: UuidGenerator::class)]
  35.     private $id;
  36.     #[ORM\Column(type'string'length180uniquetrue)]
  37.     private $email;
  38.     #[ORM\Column(type'json')]
  39.     private $roles = [];
  40.     #[ORM\Column(type'string')]
  41.     private $password;
  42.     #[ORM\Column(type'boolean')]
  43.     private $isVerified false;
  44.     #[ORM\Column(type'string'length255nullabletrue)]
  45.     private $firstName;
  46.     #[ORM\Column(type'string'length255nullabletrue)]
  47.     private $lastName;
  48.     #[ORM\Column(type'json')]
  49.     private $access = [];
  50.     #[ORM\Column(type'string'length255nullabletrue)]
  51.     private $image;
  52.     #[ORM\Column(type'bigint')]
  53.     private $wallet 0;
  54.     #[ORM\Column(type'string'length255nullabletrue)]
  55.     private ?string $mobile;
  56.     #[ORM\OneToMany(mappedBy'owner'targetEntityTransaction::class)]
  57.     private Collection $transactions;
  58.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  59.     private ?DateTimeInterface $lastLogin null;
  60.     #[ORM\ManyToOne(targetEntityself::class, inversedBy'users')]
  61.     private ?self $presenter null;
  62.     #[ORM\OneToMany(mappedBy'presenter'targetEntityself::class)]
  63.     private Collection $users;
  64.     #[ORM\Column(nullabletrue)]
  65.     private ?int $uniquePresenterCode null;
  66.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  67.     private ?\DateTimeInterface $lastBuy null;
  68.     #[ORM\Column]
  69.     private ?int $subUserCount null;
  70.     /**
  71.      * @var Collection<int, Service>
  72.      */
  73.     #[ORM\OneToMany(targetEntityService::class, mappedBy'owner')]
  74.     private Collection $services;
  75.     #[ORM\Column(nullabletrue)]
  76.     #[Assert\Range(
  77.         notInRangeMessage'
  78.         درصد سود باید بین 
  79.         {{ min }}
  80.         و 
  81.         {{ max }}
  82.         باشد',
  83.         min0,
  84.         max1000,
  85.     )]
  86.     private ?int $interestRate null;
  87.     #[ORM\Column(length255nullabletrue)]
  88.     private ?string $telegramChannel null;
  89.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  90.     private ?string $customerText null;
  91.     #[ORM\Column(nullabletrue)]
  92.     private ?int $thisMonthCharge null;
  93.     #[ORM\OneToMany(mappedBy'author'targetEntityTransaction::class)]
  94.     private Collection $madeTransactions;
  95.     #[ORM\ManyToOne(targetEntityself::class, inversedBy'advertisedUsers')]
  96.     private ?self $advertiser null;
  97.     #[ORM\OneToMany(mappedBy'advertiser'targetEntityself::class)]
  98.     private Collection $advertisedUsers;
  99.     #[ORM\Column(length255nullabletrue)]
  100.     private ?string $userTrace null;
  101.     #[ORM\ManyToOne(inversedBy'users')]
  102.     private ?Campaign $campaign null;
  103.     #[ORM\OneToMany(mappedBy'owner'targetEntityDomain::class)]
  104.     private Collection $domains;
  105.     #[ORM\Column(nullabletrue)]
  106.     private ?bool $isTelegramContact null;
  107.     #[ORM\Column(nullabletrue)]
  108.     private ?bool $isTelegramContactChecked null;
  109.     #[ORM\OneToMany(mappedBy'owner'targetEntityBot::class)]
  110.     private Collection $bots;
  111.     #[ORM\OneToMany(mappedBy'author'targetEntityIdea::class)]
  112.     private Collection $ideas;
  113.     #[ORM\Column(length255nullabletrue)]
  114.     private ?string $cardNumberToCharge null;
  115.     #[ORM\Column(typeTypes::BIGINTnullabletrue)]
  116.     private ?string $advertiserMonthlyIncome null;
  117.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  118.     private ?string $connectedTelegramUserId null;
  119.     #[ORM\OneToMany(mappedBy'panelOwner'targetEntityArzDigital::class)]
  120.     private Collection $arzDigitals;
  121.     #[ORM\Column(nullabletrue)]
  122.     private ?int $VpnServicesCount null;
  123.     #[ORM\Column(typeTypes::BIGINTnullabletrue)]
  124.     private ?string $giftWallet null;
  125.     #[ORM\OneToMany(mappedBy'owner'targetEntityIp::class)]
  126.     private Collection $hetznerIps;
  127.     #[ORM\OneToMany(mappedBy'owner'targetEntityServer::class)]
  128.     private Collection $hetznerServers;
  129.     public function __construct()
  130.     {
  131.         parent::__construct();
  132.         $this->setIsVerified(false);
  133.         $this->setInterestRate(100);
  134.         $this->setSubUserCount(0);
  135.         $this->transactions = new ArrayCollection();
  136.         $this->users = new ArrayCollection();
  137.         $this->madeTransactions = new ArrayCollection();
  138.         $this->advertisedUsers = new ArrayCollection();
  139.         $this->domains = new ArrayCollection();
  140.         $this->setIsTelegramContactChecked(0);
  141.         $this->bots = new ArrayCollection();
  142.         $this->ideas = new ArrayCollection();
  143.         $this->setCardNumberToCharge('');
  144.         $this->arzDigitals = new ArrayCollection();
  145.     }
  146.     #[Pure] public function __toString(): string
  147.     {
  148.         if ($this->getFirstName() && $this->getLastName()) {
  149.             return $this->getFirstName() . ' ' $this->getLastName();
  150.         }
  151.         return $this->getEmail();
  152.     }
  153.     public function getFirstName(): ?string
  154.     {
  155.         return $this->firstName;
  156.     }
  157.     public function setFirstName(?string $firstName): self
  158.     {
  159.         $this->firstName $firstName;
  160.         return $this;
  161.     }
  162.     public function getLastName(): ?string
  163.     {
  164.         return $this->lastName;
  165.     }
  166.     public function setLastName(?string $lastName): self
  167.     {
  168.         $this->lastName $lastName;
  169.         return $this;
  170.     }
  171.     public function getEmail(): ?string
  172.     {
  173.         return $this->email;
  174.     }
  175.     public function setEmail(string $email): self
  176.     {
  177.         $this->email $email;
  178.         return $this;
  179.     }
  180.     public function hasRole($role): bool
  181.     {
  182.         return in_array($role$this->getRoles());
  183.     }
  184.     /**
  185.      * @see UserInterface
  186.      */
  187.     public function getRoles(): array
  188.     {
  189.         $roles $this->roles;
  190.         // guarantee every user at least has ROLE_USER
  191.         $roles[] = 'ROLE_USER';
  192.         return array_unique($roles);
  193.     }
  194.     public function setRoles(array $roles): self
  195.     {
  196.         $this->roles $roles;
  197.         return $this;
  198.     }
  199.     public function getId(): ?string
  200.     {
  201.         return $this->id;
  202.     }
  203.     #[Pure] public function hasAccess($access): bool
  204.     {
  205.         return in_array($access$this->getAccess());
  206.     }
  207.     public function getAccess(): ?array
  208.     {
  209.         if ($this->access) {
  210.             return $this->access;
  211.         }
  212.         return [];
  213.     }
  214.     public function setAccess(array $access): self
  215.     {
  216.         $this->access $access;
  217.         return $this;
  218.     }
  219.     /**
  220.      * A visual identifier that represents this user.
  221.      *
  222.      * @see UserInterface
  223.      */
  224.     public function getUserIdentifier(): string
  225.     {
  226.         return (string)$this->email;
  227.     }
  228.     /**
  229.      * @deprecated since Symfony 5.3, use getUserIdentifier instead
  230.      */
  231.     public function getUsername(): string
  232.     {
  233.         return (string)$this->email;
  234.     }
  235.     /**
  236.      * @see PasswordAuthenticatedUserInterface
  237.      */
  238.     public function getPassword(): string
  239.     {
  240.         return $this->password;
  241.     }
  242.     public function setPassword(string $password): self
  243.     {
  244.         $this->password $password;
  245.         return $this;
  246.     }
  247.     /**
  248.      * Returning a salt is only needed, if you are not using a modern
  249.      * hashing algorithm (e.g. bcrypt or sodium) in your security.yaml.
  250.      *
  251.      * @see UserInterface
  252.      */
  253.     public function getSalt(): ?string
  254.     {
  255.         return null;
  256.     }
  257.     /**
  258.      * @see UserInterface
  259.      */
  260.     public function eraseCredentials()
  261.     {
  262.         // If you store any temporary, sensitive data on the user, clear it here
  263.         // $this->plainPassword = null;
  264.     }
  265.     public function getImage(): ?string
  266.     {
  267.         return $this->image;
  268.     }
  269.     public function setImage(?string $image): self
  270.     {
  271.         $this->image $image;
  272.         return $this;
  273.     }
  274.     public function getWallet(): ?string
  275.     {
  276.         return $this->wallet;
  277.     }
  278.     public function setWallet(string $wallet): self
  279.     {
  280.         $this->wallet $wallet;
  281.         return $this;
  282.     }
  283.     public function getMobile(): ?string
  284.     {
  285.         return $this->mobile;
  286.     }
  287.     public function setMobile$mobile): self
  288.     {
  289.         $this->mobile $mobile;
  290.         return $this;
  291.     }
  292.     public function getMobileColoredItem(): ?string
  293.     {
  294.         if ($this->getMobile()){
  295.             return $this->getMobile();
  296.         }else{
  297.             return  'ندارد';
  298.         }
  299.     }
  300.     /**
  301.      * @return Collection<int, Transaction>
  302.      */
  303.     public function getTransactions(): Collection
  304.     {
  305.         return $this->transactions;
  306.     }
  307.     public function addTransaction(Transaction $transaction): self
  308.     {
  309.         if (!$this->transactions->contains($transaction)) {
  310.             $this->transactions->add($transaction);
  311.             $transaction->setOwner($this);
  312.         }
  313.         return $this;
  314.     }
  315.     public function removeTransaction(Transaction $transaction): self
  316.     {
  317.         if ($this->transactions->removeElement($transaction)) {
  318.             // set the owning side to null (unless already changed)
  319.             if ($transaction->getOwner() === $this) {
  320.                 $transaction->setOwner(null);
  321.             }
  322.         }
  323.         return $this;
  324.     }
  325.     public function getLastLogin(): ?DateTimeInterface
  326.     {
  327.         return $this->lastLogin;
  328.     }
  329.     public function setLastLogin(?DateTimeInterface $lastLogin): self
  330.     {
  331.         $this->lastLogin $lastLogin;
  332.         return $this;
  333.     }
  334.     /**
  335.      * @return Collection<int, self>
  336.      */
  337.     public function getUsers(): Collection
  338.     {
  339.         return $this->users;
  340.     }
  341.     public function addUser(self $user): self
  342.     {
  343.         if (!$this->users->contains($user)) {
  344.             $this->users->add($user);
  345.             $user->setPresenter($this);
  346.         }
  347.         return $this;
  348.     }
  349.     public function removeUser(self $user): self
  350.     {
  351.         if ($this->users->removeElement($user)) {
  352.             // set the owning side to null (unless already changed)
  353.             if ($user->getPresenter() === $this) {
  354.                 $user->setPresenter(null);
  355.             }
  356.         }
  357.         return $this;
  358.     }
  359.     public function getPresenter(): ?self
  360.     {
  361.         return $this->presenter;
  362.     }
  363.     public function setPresenter(?self $presenter): self
  364.     {
  365.         $this->presenter $presenter;
  366.         return $this;
  367.     }
  368.     public function getUniquePresenterCode(): ?int
  369.     {
  370.         return $this->uniquePresenterCode;
  371.     }
  372.     public function setUniquePresenterCode(?int $uniquePresenterCode): self
  373.     {
  374.         $this->uniquePresenterCode $uniquePresenterCode;
  375.         return $this;
  376.     }
  377.     public function getLastBuy(): ?\DateTimeInterface
  378.     {
  379.         return $this->lastBuy;
  380.     }
  381.     public function setLastBuy(?\DateTimeInterface $lastBuy): self
  382.     {
  383.         $this->lastBuy $lastBuy;
  384.         return $this;
  385.     }
  386.     public function getSubUserCount(): ?int
  387.     {
  388.         return $this->subUserCount;
  389.     }
  390.     public function setSubUserCount(int $subUserCount): self
  391.     {
  392.         $this->subUserCount $subUserCount;
  393.         return $this;
  394.     }
  395.     public function getInterestRate(): ?int
  396.     {
  397.         return $this->interestRate;
  398.     }
  399.     public function setInterestRate(?int $interestRate): self
  400.     {
  401.         $this->interestRate $interestRate;
  402.         return $this;
  403.     }
  404.     public function getTelegramChannel(): ?string
  405.     {
  406.         return $this->telegramChannel;
  407.     }
  408.     public function setTelegramChannel(?string $telegramChannel): self
  409.     {
  410.         $this->telegramChannel $telegramChannel;
  411.         return $this;
  412.     }
  413.     public function getCustomerText(): ?string
  414.     {
  415.         return $this->customerText;
  416.     }
  417.     public function setCustomerText(?string $customerText): self
  418.     {
  419.         $this->customerText $customerText;
  420.         return $this;
  421.     }
  422.     public function getThisMonthCharge(): ?int
  423.     {
  424.         return $this->thisMonthCharge;
  425.     }
  426.     public function setThisMonthCharge(?int $thisMonthCharge): self
  427.     {
  428.         $this->thisMonthCharge $thisMonthCharge;
  429.         return $this;
  430.     }
  431.     /**
  432.      * @return Collection<int, Transaction>
  433.      */
  434.     public function getMadeTransactions(): Collection
  435.     {
  436.         return $this->madeTransactions;
  437.     }
  438.     public function addMadeTransaction(Transaction $madeTransaction): self
  439.     {
  440.         if (!$this->madeTransactions->contains($madeTransaction)) {
  441.             $this->madeTransactions->add($madeTransaction);
  442.             $madeTransaction->setAuthor($this);
  443.         }
  444.         return $this;
  445.     }
  446.     public function removeMadeTransaction(Transaction $madeTransaction): self
  447.     {
  448.         if ($this->madeTransactions->removeElement($madeTransaction)) {
  449.             // set the owning side to null (unless already changed)
  450.             if ($madeTransaction->getAuthor() === $this) {
  451.                 $madeTransaction->setAuthor(null);
  452.             }
  453.         }
  454.         return $this;
  455.     }
  456.     public function getAdvertiser(): ?self
  457.     {
  458.         return $this->advertiser;
  459.     }
  460.     public function setAdvertiser(?self $advertiser): self
  461.     {
  462.         $this->advertiser $advertiser;
  463.         return $this;
  464.     }
  465.     /**
  466.      * @return Collection<int, self>
  467.      */
  468.     public function getAdvertisedUsers(): Collection
  469.     {
  470.         return $this->advertisedUsers;
  471.     }
  472.     public function addAdvertisedUser(self $advertisedUser): self
  473.     {
  474.         if (!$this->advertisedUsers->contains($advertisedUser)) {
  475.             $this->advertisedUsers->add($advertisedUser);
  476.             $advertisedUser->setAdvertiser($this);
  477.         }
  478.         return $this;
  479.     }
  480.     public function removeAdvertisedUser(self $advertisedUser): self
  481.     {
  482.         if ($this->advertisedUsers->removeElement($advertisedUser)) {
  483.             // set the owning side to null (unless already changed)
  484.             if ($advertisedUser->getAdvertiser() === $this) {
  485.                 $advertisedUser->setAdvertiser(null);
  486.             }
  487.         }
  488.         return $this;
  489.     }
  490.     /**
  491.      * @return array|null
  492.      */
  493.     public function getUserTrace(): ?array
  494.     {
  495.         return json_decode($this->userTrace true);
  496.     }
  497.     /**
  498.      * @param array|null $userTrace
  499.      */
  500.     public function setUserTrace(?array $userTrace): void
  501.     {
  502.         $this->userTrace json_encode($userTrace);
  503.     }
  504.     public function getCampaign(): ?Campaign
  505.     {
  506.         return $this->campaign;
  507.     }
  508.     public function setCampaign(?Campaign $campaign): static
  509.     {
  510.         $this->campaign $campaign;
  511.         return $this;
  512.     }
  513.     /**
  514.      * @return Collection<int, Domain>
  515.      */
  516.     public function getDomains(): Collection
  517.     {
  518.         return $this->domains;
  519.     }
  520.     public function addDomain(Domain $domain): static
  521.     {
  522.         if (!$this->domains->contains($domain)) {
  523.             $this->domains->add($domain);
  524.             $domain->setOwner($this);
  525.         }
  526.         return $this;
  527.     }
  528.     public function removeDomain(Domain $domain): static
  529.     {
  530.         if ($this->domains->removeElement($domain)) {
  531.             // set the owning side to null (unless already changed)
  532.             if ($domain->getOwner() === $this) {
  533.                 $domain->setOwner(null);
  534.             }
  535.         }
  536.         return $this;
  537.     }
  538.     public function isVerified(): bool
  539.     {
  540.         return $this->isVerified;
  541.     }
  542.     public function setIsVerified(bool $isVerified): void
  543.     {
  544.         $this->isVerified $isVerified;
  545.     }
  546.     public function isIsTelegramContact(): ?bool
  547.     {
  548.         return $this->isTelegramContact;
  549.     }
  550.     public function setIsTelegramContact(?bool $isTelegramContact): static
  551.     {
  552.         $this->isTelegramContact $isTelegramContact;
  553.         return $this;
  554.     }
  555.     public function isIsTelegramContactChecked(): ?bool
  556.     {
  557.         return $this->isTelegramContactChecked;
  558.     }
  559.     public function setIsTelegramContactChecked(?bool $isTelegramContactChecked): static
  560.     {
  561.         $this->isTelegramContactChecked $isTelegramContactChecked;
  562.         return $this;
  563.     }
  564.     /**
  565.      * @return Collection<int, Bot>
  566.      */
  567.     public function getBots(): Collection
  568.     {
  569.         return $this->bots;
  570.     }
  571.     public function addBot(Bot $bot): static
  572.     {
  573.         if (!$this->bots->contains($bot)) {
  574.             $this->bots->add($bot);
  575.             $bot->setOwner($this);
  576.         }
  577.         return $this;
  578.     }
  579.     public function removeBot(Bot $bot): static
  580.     {
  581.         if ($this->bots->removeElement($bot)) {
  582.             // set the owning side to null (unless already changed)
  583.             if ($bot->getOwner() === $this) {
  584.                 $bot->setOwner(null);
  585.             }
  586.         }
  587.         return $this;
  588.     }
  589.     /**
  590.      * @return Collection<int, Idea>
  591.      */
  592.     public function getIdeas(): Collection
  593.     {
  594.         return $this->ideas;
  595.     }
  596.     public function addIdea(Idea $idea): static
  597.     {
  598.         if (!$this->ideas->contains($idea)) {
  599.             $this->ideas->add($idea);
  600.             $idea->setAuthor($this);
  601.         }
  602.         return $this;
  603.     }
  604.     public function removeIdea(Idea $idea): static
  605.     {
  606.         if ($this->ideas->removeElement($idea)) {
  607.             // set the owning side to null (unless already changed)
  608.             if ($idea->getAuthor() === $this) {
  609.                 $idea->setAuthor(null);
  610.             }
  611.         }
  612.         return $this;
  613.     }
  614.     public function getCardNumberToCharge(): ?string
  615.     {
  616.         return $this->cardNumberToCharge;
  617.     }
  618.     public function setCardNumberToCharge(?string $cardNumberToCharge): static
  619.     {
  620.         $this->cardNumberToCharge $cardNumberToCharge;
  621.         return $this;
  622.     }
  623.     public function getTheme(): ?string
  624.     {
  625. //        if ($this->hasRole('ROLE_ADMIN')){
  626.             return 'neon';
  627. //        }
  628. //        return 'default';
  629. //        return $this->theme?:'default';
  630.     }
  631.     public function setTheme(?string $theme): static
  632.     {
  633.         $this->theme $theme;
  634.         return $this;
  635.     }
  636.     public function getAdvertiserMonthlyIncome(): ?string
  637.     {
  638.         return $this->advertiserMonthlyIncome;
  639.     }
  640.     public function setAdvertiserMonthlyIncome(?string $advertiserMonthlyIncome): static
  641.     {
  642.         $this->advertiserMonthlyIncome $advertiserMonthlyIncome;
  643.         return $this;
  644.     }
  645.     public function getConnectedTelegramUserId(): ?array
  646.     {
  647.         return json_decode($this->connectedTelegramUserId true);
  648.     }
  649.     public function setConnectedTelegramUserId(?array $connectedTelegramUserId): static
  650.     {
  651.         $this->connectedTelegramUserId json_encode($connectedTelegramUserId);
  652.         return $this;
  653.     }
  654.     /**
  655.      * @return Collection<int, ArzDigital>
  656.      */
  657.     public function getArzDigitals(): Collection
  658.     {
  659.         return $this->arzDigitals;
  660.     }
  661.     public function addArzDigital(ArzDigital $arzDigital): static
  662.     {
  663.         if (!$this->arzDigitals->contains($arzDigital)) {
  664.             $this->arzDigitals->add($arzDigital);
  665.             $arzDigital->setPanelOwner($this);
  666.         }
  667.         return $this;
  668.     }
  669.     public function removeArzDigital(ArzDigital $arzDigital): static
  670.     {
  671.         if ($this->arzDigitals->removeElement($arzDigital)) {
  672.             // set the owning side to null (unless already changed)
  673.             if ($arzDigital->getPanelOwner() === $this) {
  674.                 $arzDigital->setPanelOwner(null);
  675.             }
  676.         }
  677.         return $this;
  678.     }
  679.     public function getVpnServicesCount(): ?int
  680.     {
  681.         return $this->VpnServicesCount;
  682.     }
  683.     public function setVpnServicesCount(?int $VpnServicesCount): static
  684.     {
  685.         $this->VpnServicesCount $VpnServicesCount;
  686.         return $this;
  687.     }
  688.     public function getGiftWallet(): ?string
  689.     {
  690.         return $this->giftWallet;
  691.     }
  692.     public function setGiftWallet(?string $giftWallet): static
  693.     {
  694.         $this->giftWallet $giftWallet;
  695.         return $this;
  696.     }
  697.     /**
  698.      * @return Collection<int, Ip>
  699.      */
  700.     public function getHetznerIps(): Collection
  701.     {
  702.         return $this->hetznerIps;
  703.     }
  704.     public function addHetznerIp(Ip $hetznerIp): static
  705.     {
  706.         if (!$this->hetznerIps->contains($hetznerIp)) {
  707.             $this->hetznerIps->add($hetznerIp);
  708.             $hetznerIp->setOwner($this);
  709.         }
  710.         return $this;
  711.     }
  712.     public function removeHetznerIp(Ip $hetznerIp): static
  713.     {
  714.         if ($this->hetznerIps->removeElement($hetznerIp)) {
  715.             // set the owning side to null (unless already changed)
  716.             if ($hetznerIp->getOwner() === $this) {
  717.                 $hetznerIp->setOwner(null);
  718.             }
  719.         }
  720.         return $this;
  721.     }
  722.     /**
  723.      * @return Collection<int, Server>
  724.      */
  725.     public function getHetznerServers(): Collection
  726.     {
  727.         return $this->hetznerServers;
  728.     }
  729.     public function addHetznerServer(Server $hetznerServer): static
  730.     {
  731.         if (!$this->hetznerServers->contains($hetznerServer)) {
  732.             $this->hetznerServers->add($hetznerServer);
  733.             $hetznerServer->setOwner($this);
  734.         }
  735.         return $this;
  736.     }
  737.     public function removeHetznerServer(Server $hetznerServer): static
  738.     {
  739.         if ($this->hetznerServers->removeElement($hetznerServer)) {
  740.             // set the owning side to null (unless already changed)
  741.             if ($hetznerServer->getOwner() === $this) {
  742.                 $hetznerServer->setOwner(null);
  743.             }
  744.         }
  745.         return $this;
  746.     }
  747. }