src/Entity/Country.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CountryRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassCountryRepository::class)]
  8. class Country
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column]
  13.     private ?int $id null;
  14.     #[ORM\Column(length255nullabletrue)]
  15.     private ?string $cca2 null;
  16.     #[ORM\Column(length255nullabletrue)]
  17.     private ?string $ru null;
  18.     #[ORM\Column(length255nullabletrue)]
  19.     private ?string $en null;
  20.     #[ORM\Column(length255nullabletrue)]
  21.     private ?string $flag null;
  22.     #[ORM\OneToMany(mappedBy'country'targetEntityTimeZone::class)]
  23.     private Collection $timeZones;
  24.     public function __construct()
  25.     {
  26.         $this->timeZones = new ArrayCollection();
  27.     }
  28.     public function getId(): ?int
  29.     {
  30.         return $this->id;
  31.     }
  32.     public function getCca2(): ?string
  33.     {
  34.         return $this->cca2;
  35.     }
  36.     public function setCca2(?string $cca2): self
  37.     {
  38.         $this->cca2 $cca2;
  39.         return $this;
  40.     }
  41.     public function getRu(): ?string
  42.     {
  43.         return $this->ru;
  44.     }
  45.     public function setRu(?string $ru): self
  46.     {
  47.         $this->ru $ru;
  48.         return $this;
  49.     }
  50.     public function getEn(): ?string
  51.     {
  52.         return $this->en;
  53.     }
  54.     public function setEn(?string $en): self
  55.     {
  56.         $this->en $en;
  57.         return $this;
  58.     }
  59.     public function getFlag(): ?string
  60.     {
  61.         return $this->flag;
  62.     }
  63.     public function setFlag(?string $flag): self
  64.     {
  65.         $this->flag $flag;
  66.         return $this;
  67.     }
  68.     /**
  69.      * @return Collection<int, TimeZone>
  70.      */
  71.     public function getTimeZones(): Collection
  72.     {
  73.         return $this->timeZones;
  74.     }
  75.     public function addTimeZone(TimeZone $timeZone): self
  76.     {
  77.         if (!$this->timeZones->contains($timeZone)) {
  78.             $this->timeZones->add($timeZone);
  79.             $timeZone->setCountry($this);
  80.         }
  81.         return $this;
  82.     }
  83.     public function removeTimeZone(TimeZone $timeZone): self
  84.     {
  85.         if ($this->timeZones->removeElement($timeZone)) {
  86.             // set the owning side to null (unless already changed)
  87.             if ($timeZone->getCountry() === $this) {
  88.                 $timeZone->setCountry(null);
  89.             }
  90.         }
  91.         return $this;
  92.     }
  93. }