src/Entity/Website/Country.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Website;
  3. use App\Entity\Website\VPN\V2ray\Protocol;
  4. use App\Entity\Website\VPN\V2ray\Server;
  5. use App\Repository\Website\CountryRepository;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use JetBrains\PhpStorm\Pure;
  10. use Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator;
  11. use App\Entity\BaseEntity;
  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\Website\VPN\OpenVPN\Server::class)]
  29.     private Collection $OpenVPNServers;
  30.     #[ORM\OneToMany(mappedBy'country'targetEntity\App\Entity\Website\VPN\OcServ\Server::class)]
  31.     private Collection $servers;
  32.     #[ORM\OneToMany(mappedBy'country'targetEntityProtocol::class)]
  33.     private Collection $protocols;
  34.     public function __construct()
  35.     {
  36.         parent::__construct();
  37.         $this->protocols = new ArrayCollection();
  38.     }
  39.     #[Pure] public function __toString()
  40.     {
  41.         return ($this->getTitle());
  42.     }
  43.     public function getTitle(): ?string
  44.     {
  45.         return $this->title;
  46.     }
  47.     public function setTitle(string $title): self
  48.     {
  49.         $this->title $title;
  50.         return $this;
  51.     }
  52.     public function getCode(): ?string
  53.     {
  54.         return $this->code;
  55.     }
  56.     public function setCode(string $code): self
  57.     {
  58.         $this->code $code;
  59.         return $this;
  60.     }
  61.     public function getId(): ?string
  62.     {
  63.         return $this->id;
  64.     }
  65.     public function getFlag(): ?string
  66.     {
  67.         return $this->flag;
  68.     }
  69.     public function setFlag(string $flag): self
  70.     {
  71.         $this->flag $flag;
  72.         return $this;
  73.     }
  74.     /**
  75.      * @return Collection<int, Protocol>
  76.      */
  77.     public function getProtocols(): Collection
  78.     {
  79.         return $this->protocols;
  80.     }
  81.     public function addProtocol(Protocol $protocol): static
  82.     {
  83.         if (!$this->protocols->contains($protocol)) {
  84.             $this->protocols->add($protocol);
  85.             $protocol->setCountry($this);
  86.         }
  87.         return $this;
  88.     }
  89.     public function removeProtocol(Protocol $protocol): static
  90.     {
  91.         if ($this->protocols->removeElement($protocol)) {
  92.             // set the owning side to null (unless already changed)
  93.             if ($protocol->getCountry() === $this) {
  94.                 $protocol->setCountry(null);
  95.             }
  96.         }
  97.         return $this;
  98.     }
  99. }