src/Entity/Server/Hetzner/Image.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Server\Hetzner;
  3. use App\Entity\BaseEntity;
  4. use App\Repository\Server\Hetzner\ImageRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator;
  9. #[ORM\Entity(repositoryClassImageRepository::class)]
  10. #[ORM\Table(name'`hetzner_sell_server_image`')]
  11. class Image extends BaseEntity
  12. {
  13.     #[ORM\Id]
  14.     #[ORM\Column(type'guid'uniquetrue)]
  15.     #[ORM\GeneratedValue(strategy'CUSTOM')]
  16.     #[ORM\CustomIdGenerator(class: UuidGenerator::class)]
  17.     private $id;
  18.     #[ORM\Column(length255nullabletrue)]
  19.     private ?string $architecture null;
  20.     #[ORM\Column(length255nullabletrue)]
  21.     private ?string $systemId null;
  22.     #[ORM\Column(length255nullabletrue)]
  23.     private ?string $type null;
  24.     #[ORM\Column(length255nullabletrue)]
  25.     private ?string $status null;
  26.     #[ORM\Column(length255nullabletrue)]
  27.     private ?string $name null;
  28.     #[ORM\Column(length255nullabletrue)]
  29.     private ?string $description null;
  30.     #[ORM\Column(length255nullabletrue)]
  31.     private ?string $image_size null;
  32.     #[ORM\Column(length255nullabletrue)]
  33.     private ?string $disk_size null;
  34.     #[ORM\Column(length255nullabletrue)]
  35.     private ?string $os_flavor null;
  36.     #[ORM\Column(length255nullabletrue)]
  37.     private ?string $os_version null;
  38.     #[ORM\OneToMany(mappedBy'image'targetEntityServer::class)]
  39.     private Collection $servers;
  40.     public function __construct()
  41.     {
  42.         parent::__construct();
  43.         $this->servers = new ArrayCollection();
  44.     }
  45.     public function __toString()
  46.     {
  47.         return $this->getOsFlavor().' - '.$this->getOsVersion();
  48.     }
  49.     public function getId(): ?string
  50.     {
  51.         return $this->id;
  52.     }
  53.     public function getArchitecture(): ?string
  54.     {
  55.         return $this->architecture;
  56.     }
  57.     public function setArchitecture(?string $architecture): static
  58.     {
  59.         $this->architecture $architecture;
  60.         return $this;
  61.     }
  62.     public function getSystemId(): ?string
  63.     {
  64.         return $this->systemId;
  65.     }
  66.     public function setSystemId(?string $systemId): static
  67.     {
  68.         $this->systemId $systemId;
  69.         return $this;
  70.     }
  71.     public function getType(): ?string
  72.     {
  73.         return $this->type;
  74.     }
  75.     public function setType(?string $type): static
  76.     {
  77.         $this->type $type;
  78.         return $this;
  79.     }
  80.     public function getStatus(): ?string
  81.     {
  82.         return $this->status;
  83.     }
  84.     public function setStatus(?string $status): static
  85.     {
  86.         $this->status $status;
  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 getDescription(): ?string
  99.     {
  100.         return $this->description;
  101.     }
  102.     public function setDescription(?string $description): static
  103.     {
  104.         $this->description $description;
  105.         return $this;
  106.     }
  107.     public function getImageSize(): ?string
  108.     {
  109.         return $this->image_size;
  110.     }
  111.     public function setImageSize(?string $image_size): static
  112.     {
  113.         $this->image_size $image_size;
  114.         return $this;
  115.     }
  116.     public function getDiskSize(): ?string
  117.     {
  118.         return $this->disk_size;
  119.     }
  120.     public function setDiskSize(?string $disk_size): static
  121.     {
  122.         $this->disk_size $disk_size;
  123.         return $this;
  124.     }
  125.     public function getOsFlavor(): ?string
  126.     {
  127.         return $this->os_flavor;
  128.     }
  129.     public function setOsFlavor(?string $os_flavor): static
  130.     {
  131.         $this->os_flavor $os_flavor;
  132.         return $this;
  133.     }
  134.     public function getOsVersion(): ?string
  135.     {
  136.         return $this->os_version;
  137.     }
  138.     public function setOsVersion(?string $os_version): static
  139.     {
  140.         $this->os_version $os_version;
  141.         return $this;
  142.     }
  143.     /**
  144.      * @return Collection<int, Server>
  145.      */
  146.     public function getServers(): Collection
  147.     {
  148.         return $this->servers;
  149.     }
  150.     public function addServer(Server $server): static
  151.     {
  152.         if (!$this->servers->contains($server)) {
  153.             $this->servers->add($server);
  154.             $server->setImage($this);
  155.         }
  156.         return $this;
  157.     }
  158.     public function removeServer(Server $server): static
  159.     {
  160.         if ($this->servers->removeElement($server)) {
  161.             // set the owning side to null (unless already changed)
  162.             if ($server->getImage() === $this) {
  163.                 $server->setImage(null);
  164.             }
  165.         }
  166.         return $this;
  167.     }
  168. }