src/Entity/Server/ManageIt/DataCenter.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Server\ManageIt;
  3. use App\Entity\BaseEntity;
  4. use App\Entity\Country;
  5. use App\Repository\Server\ManageIt\DataCenterRepository;
  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\Entity(repositoryClassDataCenterRepository::class)]
  12. #[ORM\Table(name'`manageit_sell_server_datacenter`')]
  13. class DataCenter 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 $id;
  20.     #[ORM\Column(length255)]
  21.     private ?string $systemId null;
  22.     #[ORM\Column(length255nullabletrue)]
  23.     private ?string $description null;
  24.     #[ORM\ManyToOne(inversedBy'manageItDataCenters')]
  25.     #[ORM\JoinColumn(nullablefalse)]
  26.     private ?Country $location null;
  27.     #[ORM\Column(typeTypes::BIGINT)]
  28.     private ?string $trafficPrice null;
  29.     #[ORM\Column(length255)]
  30.     private ?string $name null;
  31.     #[ORM\OneToMany(mappedBy'datacenter'targetEntityServerType::class)]
  32.     private Collection $serverTypes;
  33.     public function __toString()
  34.     {
  35.         return $this->getLocation().' - '.'tehrannet' .' - '.  $this->getName();
  36.     }
  37.     public function __construct()
  38.     {
  39.         parent::__construct();
  40.         $this->serverTypes = new ArrayCollection();
  41.     }
  42.     public function getId(): ?string
  43.     {
  44.         return $this->id;
  45.     }
  46.     public function getSystemId(): ?string
  47.     {
  48.         return $this->systemId;
  49.     }
  50.     public function setSystemId(string $systemId): static
  51.     {
  52.         $this->systemId $systemId;
  53.         return $this;
  54.     }
  55.     public function getDescription(): ?string
  56.     {
  57.         return $this->description;
  58.     }
  59.     public function setDescription(?string $description): static
  60.     {
  61.         $this->description $description;
  62.         return $this;
  63.     }
  64.     public function getLocation(): ?Country
  65.     {
  66.         return $this->location;
  67.     }
  68.     public function setLocation(?Country $location): static
  69.     {
  70.         $this->location $location;
  71.         return $this;
  72.     }
  73.     public function getTrafficPrice(): ?string
  74.     {
  75.         return $this->trafficPrice;
  76.     }
  77.     public function setTrafficPrice(string $trafficPrice): static
  78.     {
  79.         $this->trafficPrice $trafficPrice;
  80.         return $this;
  81.     }
  82.     public function getName(): ?string
  83.     {
  84.         return $this->name;
  85.     }
  86.     public function setName(string $name): static
  87.     {
  88.         $this->name $name;
  89.         return $this;
  90.     }
  91.     /**
  92.      * @return Collection<int, ServerType>
  93.      */
  94.     public function getServerTypes(): Collection
  95.     {
  96.         return $this->serverTypes;
  97.     }
  98.     public function addServerType(ServerType $serverType): static
  99.     {
  100.         if (!$this->serverTypes->contains($serverType)) {
  101.             $this->serverTypes->add($serverType);
  102.             $serverType->setDatacenter($this);
  103.         }
  104.         return $this;
  105.     }
  106.     public function removeServerType(ServerType $serverType): static
  107.     {
  108.         if ($this->serverTypes->removeElement($serverType)) {
  109.             // set the owning side to null (unless already changed)
  110.             if ($serverType->getDatacenter() === $this) {
  111.                 $serverType->setDatacenter(null);
  112.             }
  113.         }
  114.         return $this;
  115.     }
  116. }