<?php
namespace App\Entity;
use App\Repository\CountriesRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Symfony\Component\Serializer\Annotation\Groups;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=CountriesRepository::class)
*/
class Countries
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
* Groups("customer")
* @Groups({
* "country.base",
* "counties.basic",
* "project.branches",
* "project.owner",
* "project.base",
* "countries.base",
* "customer.list.base",
* "customer.manage.base",
* "branch.location.base",
*
* "country.core"
* })
*
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
* @Groups({
* "counties.basic",
* "project.branches",
* "project.owner",
* "project.base",
* "countries.base",
* "customer.list.base",
* "customer.manage.base",
* "branch.location.base",
* "project.list.with.necessary.details",
*
* "project.details",
*
* "country.base",
*
* "country.core"
* })
*/
private $name;
/**
* @ORM\Column(type="string", length=5)
*/
private $iso_code;
/**
* @ORM\OneToMany(targetEntity=ProjectOwner::class, mappedBy="country")
*/
private $projectOwners;
/**
* @ORM\OneToMany(targetEntity=Projects::class, mappedBy="country")
*/
private $projects;
/**
* @ORM\OneToMany(targetEntity=Addresses::class, mappedBy="country")
*/
private $addresses;
public function __construct()
{
$this->customers = new ArrayCollection();
$this->projectOwners = new ArrayCollection();
$this->projects = new ArrayCollection();
$this->addresses = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getIsoCode(): ?string
{
return $this->iso_code;
}
public function setIsoCode(string $iso_code): self
{
$this->iso_code = $iso_code;
return $this;
}
/**
* @return Collection<int, ProjectOwner>
*/
public function getProjectOwners(): Collection
{
return $this->projectOwners;
}
public function addProjectOwner(ProjectOwner $projectOwner): self
{
if (!$this->projectOwners->contains($projectOwner)) {
$this->projectOwners[] = $projectOwner;
$projectOwner->setCountry($this);
}
return $this;
}
public function removeProjectOwner(ProjectOwner $projectOwner): self
{
if ($this->projectOwners->removeElement($projectOwner)) {
// set the owning side to null (unless already changed)
if ($projectOwner->getCountry() === $this) {
$projectOwner->setCountry(null);
}
}
return $this;
}
/**
* @return Collection<int, Projects>
*/
public function getProjects(): Collection
{
return $this->projects;
}
public function addProject(Projects $project): self
{
if (!$this->projects->contains($project)) {
$this->projects[] = $project;
$project->setCountry($this);
}
return $this;
}
public function removeProject(Projects $project): self
{
if ($this->projects->removeElement($project)) {
// set the owning side to null (unless already changed)
if ($project->getCountry() === $this) {
$project->setCountry(null);
}
}
return $this;
}
/**
* @return Collection<int, Addresses>
*/
public function getAddresses(): Collection
{
return $this->addresses;
}
public function addAdress(Addresses $adress): self
{
if (!$this->addresses->contains($adress)) {
$this->addresses[] = $adress;
$adress->setCountry($this);
}
return $this;
}
public function removeAdress(Addresses $adress): self
{
if ($this->addresses->removeElement($adress)) {
// set the owning side to null (unless already changed)
if ($adress->getCountry() === $this) {
$adress->setCountry(null);
}
}
return $this;
}
}