src/Entity/Server/Hetzner/ServerType.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Server\Hetzner;
  3. use App\Entity\BaseEntity;
  4. use App\Repository\Server\Hetzner\ServerTypeRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\DBAL\Types\Types;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator;
  10. #[ORM\Entity(repositoryClassServerTypeRepository::class)]
  11. #[ORM\Table(name'`hetzner_sell_server_server_type`')]
  12. class ServerType extends BaseEntity
  13. {
  14.     #[ORM\Id]
  15.     #[ORM\Column(type'guid'uniquetrue)]
  16.     #[ORM\GeneratedValue(strategy'CUSTOM')]
  17.     #[ORM\CustomIdGenerator(class: UuidGenerator::class)]
  18.     private $id;
  19.     #[ORM\Column(length255nullabletrue)]
  20.     private ?string $systemId null;
  21.     #[ORM\Column(length255nullabletrue)]
  22.     private ?string $name null;
  23.     #[ORM\Column(length255nullabletrue)]
  24.     private ?string $description null;
  25.     #[ORM\Column]
  26.     private ?int $cores null;
  27.     #[ORM\Column]
  28.     private ?float $memory null;
  29.     #[ORM\Column]
  30.     private ?float $disk null;
  31.     #[ORM\Column]
  32.     private ?bool $isDeprecated null;
  33.     public string $hourlyPrice;
  34.     public string $monthlyPrice;
  35.     #[ORM\Column(length255nullabletrue)]
  36.     private ?string $storageType null;
  37.     #[ORM\Column(length255nullabletrue)]
  38.     private ?string $cpuType null;
  39.     #[ORM\Column(length255nullabletrue)]
  40.     private ?string $architecture null;
  41.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  42.     private ?\DateTimeInterface $deprecation null;
  43.     #[ORM\OneToMany(mappedBy'serverType'targetEntityServerTypePrice::class)]
  44.     private Collection $serverTypePrices;
  45.     #[ORM\OneToMany(mappedBy'serverType'targetEntityServer::class)]
  46.     private Collection $servers;
  47.     #[ORM\OneToMany(mappedBy'serverType'targetEntityDataCenterSupportedServerTypes::class)]
  48.     private Collection $dataCenterSupportedServerTypes;
  49.     public function __construct()
  50.     {
  51.         parent::__construct();
  52.         $this->serverTypePrices = new ArrayCollection();
  53.         $this->servers = new ArrayCollection();
  54.         $this->dataCenterSupportedServerTypes = new ArrayCollection();
  55.     }
  56.     public function __toString()
  57.     {
  58.         return
  59.             'Cpu : '.$this->cpuType
  60.             ' - '
  61.             .'Core : ' $this->getCores()
  62.             . ' - '
  63.             .'Memory : '.$this->getMemory();
  64.     }
  65.     public function getId(): ?string
  66.     {
  67.         return $this->id;
  68.     }
  69.     public function getSystemId(): ?string
  70.     {
  71.         return $this->systemId;
  72.     }
  73.     public function setSystemId(?string $systemId): static
  74.     {
  75.         $this->systemId $systemId;
  76.         return $this;
  77.     }
  78.     public function getName(): ?string
  79.     {
  80.         return $this->name;
  81.     }
  82.     public function setName(?string $name): static
  83.     {
  84.         $this->name $name;
  85.         return $this;
  86.     }
  87.     public function getDescription(): ?string
  88.     {
  89.         return $this->description;
  90.     }
  91.     public function setDescription(?string $description): static
  92.     {
  93.         $this->description $description;
  94.         return $this;
  95.     }
  96.     public function getCores(): ?int
  97.     {
  98.         return $this->cores;
  99.     }
  100.     public function setCores(int $cores): static
  101.     {
  102.         $this->cores $cores;
  103.         return $this;
  104.     }
  105.     public function getMemory(): ?float
  106.     {
  107.         return $this->memory;
  108.     }
  109.     public function setMemory(float $memory): static
  110.     {
  111.         $this->memory $memory;
  112.         return $this;
  113.     }
  114.     public function getDisk(): ?float
  115.     {
  116.         return $this->disk;
  117.     }
  118.     public function setDisk(float $disk): static
  119.     {
  120.         $this->disk $disk;
  121.         return $this;
  122.     }
  123.     public function isIsDeprecated(): ?bool
  124.     {
  125.         return $this->isDeprecated;
  126.     }
  127.     public function setIsDeprecated(bool $isDeprecated): static
  128.     {
  129.         $this->isDeprecated $isDeprecated;
  130.         return $this;
  131.     }
  132.     public function getStorageType(): ?string
  133.     {
  134.         return $this->storageType;
  135.     }
  136.     public function setStorageType(?string $storageType): static
  137.     {
  138.         $this->storageType $storageType;
  139.         return $this;
  140.     }
  141.     public function getCpuType(): ?string
  142.     {
  143.         return $this->cpuType;
  144.     }
  145.     public function setCpuType(?string $cpuType): static
  146.     {
  147.         $this->cpuType $cpuType;
  148.         return $this;
  149.     }
  150.     public function getArchitecture(): ?string
  151.     {
  152.         return $this->architecture;
  153.     }
  154.     public function setArchitecture(?string $architecture): static
  155.     {
  156.         $this->architecture $architecture;
  157.         return $this;
  158.     }
  159.     public function getDeprecation(): ?\DateTimeInterface
  160.     {
  161.         return $this->deprecation;
  162.     }
  163.     public function setDeprecation(?\DateTimeInterface $deprecation): static
  164.     {
  165.         $this->deprecation $deprecation;
  166.         return $this;
  167.     }
  168.     /**
  169.      * @return Collection<int, ServerTypePrice>
  170.      */
  171.     public function getServerTypePrices(): Collection
  172.     {
  173.         return $this->serverTypePrices;
  174.     }
  175.     public function addServerTypePrice(ServerTypePrice $serverTypePrice): static
  176.     {
  177.         if (!$this->serverTypePrices->contains($serverTypePrice)) {
  178.             $this->serverTypePrices->add($serverTypePrice);
  179.             $serverTypePrice->setServerType($this);
  180.         }
  181.         return $this;
  182.     }
  183.     public function removeServerTypePrice(ServerTypePrice $serverTypePrice): static
  184.     {
  185.         if ($this->serverTypePrices->removeElement($serverTypePrice)) {
  186.             // set the owning side to null (unless already changed)
  187.             if ($serverTypePrice->getServerType() === $this) {
  188.                 $serverTypePrice->setServerType(null);
  189.             }
  190.         }
  191.         return $this;
  192.     }
  193.     /**
  194.      * @return Collection<int, Server>
  195.      */
  196.     public function getServers(): Collection
  197.     {
  198.         return $this->servers;
  199.     }
  200.     public function addServer(Server $server): static
  201.     {
  202.         if (!$this->servers->contains($server)) {
  203.             $this->servers->add($server);
  204.             $server->setServerType($this);
  205.         }
  206.         return $this;
  207.     }
  208.     public function removeServer(Server $server): static
  209.     {
  210.         if ($this->servers->removeElement($server)) {
  211.             // set the owning side to null (unless already changed)
  212.             if ($server->getServerType() === $this) {
  213.                 $server->setServerType(null);
  214.             }
  215.         }
  216.         return $this;
  217.     }
  218.     /**
  219.      * @return Collection<int, DataCenterSupportedServerTypes>
  220.      */
  221.     public function getDataCenterSupportedServerTypes(): Collection
  222.     {
  223.         return $this->dataCenterSupportedServerTypes;
  224.     }
  225.     public function addDataCenterSupportedServerType(DataCenterSupportedServerTypes $dataCenterSupportedServerType): static
  226.     {
  227.         if (!$this->dataCenterSupportedServerTypes->contains($dataCenterSupportedServerType)) {
  228.             $this->dataCenterSupportedServerTypes->add($dataCenterSupportedServerType);
  229.             $dataCenterSupportedServerType->setServerType($this);
  230.         }
  231.         return $this;
  232.     }
  233.     public function removeDataCenterSupportedServerType(DataCenterSupportedServerTypes $dataCenterSupportedServerType): static
  234.     {
  235.         if ($this->dataCenterSupportedServerTypes->removeElement($dataCenterSupportedServerType)) {
  236.             // set the owning side to null (unless already changed)
  237.             if ($dataCenterSupportedServerType->getServerType() === $this) {
  238.                 $dataCenterSupportedServerType->setServerType(null);
  239.             }
  240.         }
  241.         return $this;
  242.     }
  243.     public function getMonthlyPrice(): string
  244.     {
  245.         return $this->monthlyPrice;
  246.     }
  247.     public function setMonthlyPrice(string $monthlyPrice): void
  248.     {
  249.         $this->monthlyPrice $monthlyPrice;
  250.     }
  251.     public function getHourlyPrice(): string
  252.     {
  253.         return $this->hourlyPrice;
  254.     }
  255.     public function setHourlyPrice(string $hourlyPrice): void
  256.     {
  257.         $this->hourlyPrice $hourlyPrice;
  258.     }
  259. }