<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Table(options={"comment":"Obsahuje seznam dostupnych zemi"},
* indexes={
* @ORM\Index(name="country_name", columns={"name"}),
* @ORM\Index(name="country_iso", columns={"iso"}),
* @ORM\Index(name="country_iso3", columns={"iso3"}),
* })
* @ORM\Entity(repositoryClass="App\Repository\CountryRepository")
*/
class Country
{
/**
* @ORM\Id()
* @ORM\GeneratedValue(strategy="IDENTITY")
* @ORM\Column( type="integer")
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Language", inversedBy="countries")
* @ORM\JoinColumn( onDelete="CASCADE")
*/
private $language;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Currency", inversedBy="countries")
* @ORM\JoinColumn(onDelete="CASCADE")
*/
private $currency;
/**
* @ORM\Column(name="name", type="string", length=63, unique=true, options={"comment":"nazev zeme v cestine"})
*/
private $name;
/**
* @ORM\Column(name="nameOrigin", type="string", length=63, unique=true, nullable=true, options={"comment":"nazev zeme v jejim jazyce"})
*/
private $nameOrigin;
/**
* @ORM\Column(name="iso3", type="string", length=3, unique=true, options={"comment":"ISO 3166-1 Alpha-3 kod zeme"})
*/
private $iso3;
/**
* @ORM\Column(name="iso", type="string", length=2, unique=true, options={"comment":"ISO 3166-1 Alpha-2 kod zeme"})
*/
private $iso;
/**
* @ORM\Column(type="decimal", precision=4, scale=2, options={"default":0, "comment":"vychozi hodnota dane pro nove objednavky"})
*/
private $vat = 0;
/**
* @ORM\OneToMany(targetEntity=CarrierPrice::class, mappedBy="country")
*/
private $carrierPrices;
public function __construct()
{
$this->carrierPrices = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName($name): self
{
$this->name = $name;
return $this;
}
public function getNameOrigin(): ?string
{
return $this->nameOrigin;
}
public function setNameOrigin($nameOrigin): self
{
$this->nameOrigin = $nameOrigin;
return $this;
}
public function getIso3(): ?string
{
return $this->iso3;
}
public function setIso3($iso3): self
{
$this->iso3 = $iso3;
return $this;
}
public function getIso(): ?string
{
return $this->iso;
}
public function setIso($iso): self
{
$this->iso = $iso;
return $this;
}
public function getVat(): ?string
{
return $this->vat;
}
public function setVat($vat): self
{
$this->vat = $vat;
return $this;
}
public function getLanguage(): ?Language
{
return $this->language;
}
public function setLanguage($language): self
{
$this->language = $language;
return $this;
}
public function getCurrency(): ?Currency
{
return $this->currency;
}
public function setCurrency($currency): self
{
$this->currency = $currency;
return $this;
}
/**
* @return Collection|CarrierPrice[]
*/
public function getCarrierPrices(): Collection
{
return $this->carrierPrices;
}
public function addCarrierPrice(CarrierPrice $carrierPrice): self
{
if (!$this->carrierPrices->contains($carrierPrice)) {
$this->carrierPrices[] = $carrierPrice;
$carrierPrice->setCountry($this);
}
return $this;
}
public function removeCarrierPrice(CarrierPrice $carrierPrice): self
{
if ($this->carrierPrices->removeElement($carrierPrice)) {
// set the owning side to null (unless already changed)
if ($carrierPrice->getCountry() === $this) {
$carrierPrice->setCountry(null);
}
}
return $this;
}
}