<?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(type: 'integer')]
private $id;
#[ORM\ManyToOne(targetEntity: Zone::class, inversedBy: 'countries')]
private ?\App\Entity\Zone $zone = null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $name = null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $slug = null;
#[ORM\OneToMany(targetEntity: User::class, mappedBy: 'country')]
private Collection $users;
#[ORM\Column(type: 'integer', nullable: true, options: ['default' => 1])]
private ?int $ordering = null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $nationality = null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $language = null;
public function __construct()
{
$this->users = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getZone(): ?Zone
{
return $this->zone;
}
public function setZone(?Zone $zone): self
{
$this->zone = $zone;
return $this;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(?string $name): self
{
$this->name = $name;
return $this;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug(?string $slug): self
{
$this->slug = $slug;
return $this;
}
/**
* @return Collection<int, User>
*/
public function getUsers(): Collection
{
return $this->users;
}
public function addUser(User $user): self
{
if (!$this->users->contains($user)) {
$this->users[] = $user;
$user->setCountry($this);
}
return $this;
}
public function removeUser(User $user): self
{
if ($this->users->removeElement($user)) {
// set the owning side to null (unless already changed)
if ($user->getCountry() === $this) {
$user->setCountry(null);
}
}
return $this;
}
public function getOrdering(): ?int
{
return $this->ordering;
}
public function setOrdering(int $ordering): self
{
$this->ordering = $ordering;
return $this;
}
public function getNationality(): ?string
{
return $this->nationality;
}
public function setNationality(?string $nationality): self
{
$this->nationality = $nationality;
return $this;
}
public function getLanguage(): ?string
{
return $this->language;
}
public function setLanguage(?string $language): self
{
$this->language = $language;
return $this;
}
}