src/Entity/Country.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Server\ManageIt\DataCenter;
  4. use App\Entity\VPN\V2ray\Protocol;
  5. use App\Entity\VPN\V2ray\Server;
  6. use App\Repository\CountryRepository;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. use Doctrine\Common\Collections\Collection;
  9. use Doctrine\ORM\Mapping as ORM;
  10. use JetBrains\PhpStorm\Pure;
  11. use Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator;
  12. #[ORM\Entity(repositoryClassCountryRepository::class)]
  13. class Country extends BaseEntity
  14. {
  15.     #[ORM\Id]
  16.     #[ORM\Column(type'guid'uniquetrue)]
  17.     #[ORM\GeneratedValue(strategy'CUSTOM')]
  18.     #[ORM\CustomIdGenerator(class: UuidGenerator::class)]
  19.     private ?string $id null;
  20.     #[ORM\Column(length255)]
  21.     private ?string $title null;
  22.     #[ORM\Column(length255)]
  23.     private ?string $code null;
  24.     #[ORM\Column(length255)]
  25.     private ?string $flag null;
  26.     #[ORM\OneToMany(mappedBy'country'targetEntityServer::class)]
  27.     private Collection $v2rayServers;
  28.     #[ORM\OneToMany(mappedBy'country'targetEntity\App\Entity\VPN\OpenVPN\Server::class)]
  29.     private Collection $OpenVPNServers;
  30.     #[ORM\OneToMany(mappedBy'country'targetEntity\App\Entity\VPN\OcServ\Server::class)]
  31.     private Collection $servers;
  32.     #[ORM\OneToMany(mappedBy'country'targetEntityProtocol::class)]
  33.     private Collection $protocols;
  34.     #[ORM\OneToMany(mappedBy'location'targetEntityDataCenter::class)]
  35.     private Collection $manageItDataCenters;
  36.     public function __construct()
  37.     {
  38.         parent::__construct();
  39.         $this->protocols = new ArrayCollection();
  40.         $this->manageItDataCenters = new ArrayCollection();
  41.     }
  42.     #[Pure] public function __toString()
  43.     {
  44.         return ($this->getTitle());
  45.     }
  46.     public function getTitle(): ?string
  47.     {
  48.         return $this->title;
  49.     }
  50.     public function setTitle(string $title): self
  51.     {
  52.         $this->title $title;
  53.         return $this;
  54.     }
  55.     public function getCode(): ?string
  56.     {
  57.         return $this->code;
  58.     }
  59.     public function setCode(string $code): self
  60.     {
  61.         $this->code $code;
  62.         return $this;
  63.     }
  64.     public function getId(): ?string
  65.     {
  66.         return $this->id;
  67.     }
  68.     public function getFlag(): ?string
  69.     {
  70.         return $this->flag;
  71.     }
  72.     public function setFlag(string $flag): self
  73.     {
  74.         $this->flag $flag;
  75.         return $this;
  76.     }
  77.     /**
  78.      * @return Collection<int, Protocol>
  79.      */
  80.     public function getProtocols(): Collection
  81.     {
  82.         return $this->protocols;
  83.     }
  84.     public function addProtocol(Protocol $protocol): static
  85.     {
  86.         if (!$this->protocols->contains($protocol)) {
  87.             $this->protocols->add($protocol);
  88.             $protocol->setCountry($this);
  89.         }
  90.         return $this;
  91.     }
  92.     public function removeProtocol(Protocol $protocol): static
  93.     {
  94.         if ($this->protocols->removeElement($protocol)) {
  95.             // set the owning side to null (unless already changed)
  96.             if ($protocol->getCountry() === $this) {
  97.                 $protocol->setCountry(null);
  98.             }
  99.         }
  100.         return $this;
  101.     }
  102.     /**
  103.      * @return Collection<int, DataCenter>
  104.      */
  105.     public function getManageItDataCenters(): Collection
  106.     {
  107.         return $this->manageItDataCenters;
  108.     }
  109.     public function addManageItDataCenter(DataCenter $manageItDataCenter): static
  110.     {
  111.         if (!$this->manageItDataCenters->contains($manageItDataCenter)) {
  112.             $this->manageItDataCenters->add($manageItDataCenter);
  113.             $manageItDataCenter->setLocation($this);
  114.         }
  115.         return $this;
  116.     }
  117.     public function removeManageItDataCenter(DataCenter $manageItDataCenter): static
  118.     {
  119.         if ($this->manageItDataCenters->removeElement($manageItDataCenter)) {
  120.             // set the owning side to null (unless already changed)
  121.             if ($manageItDataCenter->getLocation() === $this) {
  122.                 $manageItDataCenter->setLocation(null);
  123.             }
  124.         }
  125.         return $this;
  126.     }
  127. }