src/Entity/VPN/OcServ/Server.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity\VPN\OcServ;
  3. use App\Entity\BaseEntity;
  4. use App\Entity\Country;
  5. use App\Repository\VPN\OcServ\ServerRepository;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\DBAL\Types\Types;
  9. use Doctrine\ORM\Mapping as ORM;
  10. use Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator;
  11. #[ORM\Table(name'`ocserv_server`')]
  12. #[ORM\Entity(repositoryClassServerRepository::class)]
  13. class Server 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 $ip null;
  22.     #[ORM\Column(length255)]
  23.     private ?string $sshUsername null;
  24.     #[ORM\Column(length255)]
  25.     private ?string $sshPassword null;
  26.     #[ORM\Column]
  27.     private ?int $servicePort null;
  28.     #[ORM\Column(length255)]
  29.     private ?string $name null;
  30.     #[ORM\ManyToOne(inversedBy'servers')]
  31.     #[ORM\JoinColumn(nullablefalse)]
  32.     private ?Country $country null;
  33.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  34.     private ?string $passwdContent null;
  35.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  36.     private ?string $note null;
  37.     #[ORM\Column(nullabletrue)]
  38.     private ?int $totalServicesCount null;
  39.     /**
  40.      * @var Collection<int, Protocol>
  41.      */
  42.     #[ORM\OneToMany(targetEntityProtocol::class, mappedBy'server')]
  43.     private Collection $protocols;
  44.     public function __construct()
  45.     {
  46.         parent::__construct();
  47.         $this->protocols = new ArrayCollection();
  48.     }
  49.     public function getId(): ?string
  50.     {
  51.         return $this->id;
  52.     }
  53.     public function getIp(): ?string
  54.     {
  55.         return $this->ip;
  56.     }
  57.     public function setIp(string $ip): static
  58.     {
  59.         $this->ip $ip;
  60.         return $this;
  61.     }
  62.     public function getSshUsername(): ?string
  63.     {
  64.         return $this->sshUsername;
  65.     }
  66.     public function setSshUsername(string $sshUsername): static
  67.     {
  68.         $this->sshUsername $sshUsername;
  69.         return $this;
  70.     }
  71.     public function getSshPassword(): ?string
  72.     {
  73.         return $this->sshPassword;
  74.     }
  75.     public function setSshPassword(string $sshPassword): static
  76.     {
  77.         $this->sshPassword $sshPassword;
  78.         return $this;
  79.     }
  80.     public function getServicePort(): ?int
  81.     {
  82.         return $this->servicePort;
  83.     }
  84.     public function setServicePort(int $servicePort): static
  85.     {
  86.         $this->servicePort $servicePort;
  87.         return $this;
  88.     }
  89.     public function getName(): ?string
  90.     {
  91.         return $this->name;
  92.     }
  93.     public function setName(string $name): static
  94.     {
  95.         $this->name $name;
  96.         return $this;
  97.     }
  98.     public function getCountry(): ?Country
  99.     {
  100.         return $this->country;
  101.     }
  102.     public function setCountry(?Country $country): static
  103.     {
  104.         $this->country $country;
  105.         return $this;
  106.     }
  107.     public function getPasswdContent(): ?string
  108.     {
  109.         return $this->passwdContent;
  110.     }
  111.     public function setPasswdContent(?string $passwdContent): static
  112.     {
  113.         $this->passwdContent $passwdContent;
  114.         return $this;
  115.     }
  116.     public function getNote(): ?string
  117.     {
  118.         return $this->note;
  119.     }
  120.     public function setNote(?string $note): static
  121.     {
  122.         $this->note $note;
  123.         return $this;
  124.     }
  125.     public function getTotalServicesCount(): ?int
  126.     {
  127.         return $this->totalServicesCount;
  128.     }
  129.     public function setTotalServicesCount(?int $totalServicesCount): static
  130.     {
  131.         $this->totalServicesCount $totalServicesCount;
  132.         return $this;
  133.     }
  134.     /**
  135.      * @return Collection<int, Protocol>
  136.      */
  137.     public function getProtocols(): Collection
  138.     {
  139.         return $this->protocols;
  140.     }
  141.     public function addProtocol(Protocol $protocol): static
  142.     {
  143.         if (!$this->protocols->contains($protocol)) {
  144.             $this->protocols->add($protocol);
  145.             $protocol->setServer($this);
  146.         }
  147.         return $this;
  148.     }
  149.     public function removeProtocol(Protocol $protocol): static
  150.     {
  151.         if ($this->protocols->removeElement($protocol)) {
  152.             // set the owning side to null (unless already changed)
  153.             if ($protocol->getServer() === $this) {
  154.                 $protocol->setServer(null);
  155.             }
  156.         }
  157.         return $this;
  158.     }
  159. }