src/Entity/Country.php line 19

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. /**
  7.  * @ORM\Table(options={"comment":"Obsahuje seznam dostupnych zemi"},
  8.  * indexes={
  9.  * @ORM\Index(name="country_name", columns={"name"}),
  10.  * @ORM\Index(name="country_iso", columns={"iso"}),
  11.  * @ORM\Index(name="country_iso3", columns={"iso3"}),
  12.  * })
  13.  * @ORM\Entity(repositoryClass="App\Repository\CountryRepository")
  14.  */
  15. class Country
  16. {
  17.     /**
  18.      * @ORM\Id()
  19.      * @ORM\GeneratedValue(strategy="IDENTITY")
  20.      * @ORM\Column( type="integer")
  21.      */
  22.     private $id;
  23.     /**
  24.      * @ORM\ManyToOne(targetEntity="App\Entity\Language", inversedBy="countries")
  25.      * @ORM\JoinColumn( onDelete="CASCADE")
  26.      */
  27.     private $language;
  28.     /**
  29.      * @ORM\ManyToOne(targetEntity="App\Entity\Currency", inversedBy="countries")
  30.      * @ORM\JoinColumn(onDelete="CASCADE")
  31.      */
  32.     private $currency;
  33.     /**
  34.      * @ORM\Column(name="name", type="string", length=63, unique=true, options={"comment":"nazev zeme v cestine"})
  35.      */
  36.     private $name;
  37.     /**
  38.      * @ORM\Column(name="nameOrigin", type="string", length=63, unique=true, nullable=true, options={"comment":"nazev zeme v jejim jazyce"})
  39.      */
  40.     private $nameOrigin;
  41.     /**
  42.      * @ORM\Column(name="iso3", type="string", length=3, unique=true, options={"comment":"ISO 3166-1 Alpha-3 kod zeme"})
  43.      */
  44.     private $iso3;
  45.     /**
  46.      * @ORM\Column(name="iso", type="string", length=2, unique=true, options={"comment":"ISO 3166-1 Alpha-2 kod zeme"})
  47.      */
  48.     private $iso;
  49.     /**
  50.      * @ORM\Column(type="decimal", precision=4, scale=2, options={"default":0, "comment":"vychozi hodnota dane pro nove objednavky"})
  51.      */
  52.     private $vat 0;
  53.     /**
  54.      * @ORM\OneToMany(targetEntity=CarrierPrice::class, mappedBy="country")
  55.      */
  56.     private $carrierPrices;
  57.     public function __construct()
  58.     {
  59.         $this->carrierPrices = new ArrayCollection();
  60.     }
  61.     public function getId(): ?int
  62.     {
  63.         return $this->id;
  64.     }
  65.     public function getName(): ?string
  66.     {
  67.         return $this->name;
  68.     }
  69.     public function setName($name): self
  70.     {
  71.         $this->name $name;
  72.         return $this;
  73.     }
  74.     public function getNameOrigin(): ?string
  75.     {
  76.         return $this->nameOrigin;
  77.     }
  78.     public function setNameOrigin($nameOrigin): self
  79.     {
  80.         $this->nameOrigin $nameOrigin;
  81.         return $this;
  82.     }
  83.     public function getIso3(): ?string
  84.     {
  85.         return $this->iso3;
  86.     }
  87.     public function setIso3($iso3): self
  88.     {
  89.         $this->iso3 $iso3;
  90.         return $this;
  91.     }
  92.     public function getIso(): ?string
  93.     {
  94.         return $this->iso;
  95.     }
  96.     public function setIso($iso): self
  97.     {
  98.         $this->iso $iso;
  99.         return $this;
  100.     }
  101.     public function getVat(): ?string
  102.     {
  103.         return $this->vat;
  104.     }
  105.     public function setVat($vat): self
  106.     {
  107.         $this->vat $vat;
  108.         return $this;
  109.     }
  110.     public function getLanguage(): ?Language
  111.     {
  112.         return $this->language;
  113.     }
  114.     public function setLanguage($language): self
  115.     {
  116.         $this->language $language;
  117.         return $this;
  118.     }
  119.     public function getCurrency(): ?Currency
  120.     {
  121.         return $this->currency;
  122.     }
  123.     public function setCurrency($currency): self
  124.     {
  125.         $this->currency $currency;
  126.         return $this;
  127.     }
  128.     /**
  129.      * @return Collection|CarrierPrice[]
  130.      */
  131.     public function getCarrierPrices(): Collection
  132.     {
  133.         return $this->carrierPrices;
  134.     }
  135.     public function addCarrierPrice(CarrierPrice $carrierPrice): self
  136.     {
  137.         if (!$this->carrierPrices->contains($carrierPrice)) {
  138.             $this->carrierPrices[] = $carrierPrice;
  139.             $carrierPrice->setCountry($this);
  140.         }
  141.         return $this;
  142.     }
  143.     public function removeCarrierPrice(CarrierPrice $carrierPrice): self
  144.     {
  145.         if ($this->carrierPrices->removeElement($carrierPrice)) {
  146.             // set the owning side to null (unless already changed)
  147.             if ($carrierPrice->getCountry() === $this) {
  148.                 $carrierPrice->setCountry(null);
  149.             }
  150.         }
  151.         return $this;
  152.     }
  153. }