<?php
namespace App\Entity;
use App\Repository\CountryRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: CountryRepository::class)]
class Country
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $cca2 = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $ru = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $en = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $flag = null;
#[ORM\OneToMany(mappedBy: 'country', targetEntity: TimeZone::class)]
private Collection $timeZones;
public function __construct()
{
$this->timeZones = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getCca2(): ?string
{
return $this->cca2;
}
public function setCca2(?string $cca2): self
{
$this->cca2 = $cca2;
return $this;
}
public function getRu(): ?string
{
return $this->ru;
}
public function setRu(?string $ru): self
{
$this->ru = $ru;
return $this;
}
public function getEn(): ?string
{
return $this->en;
}
public function setEn(?string $en): self
{
$this->en = $en;
return $this;
}
public function getFlag(): ?string
{
return $this->flag;
}
public function setFlag(?string $flag): self
{
$this->flag = $flag;
return $this;
}
/**
* @return Collection<int, TimeZone>
*/
public function getTimeZones(): Collection
{
return $this->timeZones;
}
public function addTimeZone(TimeZone $timeZone): self
{
if (!$this->timeZones->contains($timeZone)) {
$this->timeZones->add($timeZone);
$timeZone->setCountry($this);
}
return $this;
}
public function removeTimeZone(TimeZone $timeZone): self
{
if ($this->timeZones->removeElement($timeZone)) {
// set the owning side to null (unless already changed)
if ($timeZone->getCountry() === $this) {
$timeZone->setCountry(null);
}
}
return $this;
}
}