<?phpnamespace 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{ const COUNTRY_ROMANIA = 1; /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=255) */ private string $name; /** * @ORM\Column(type="boolean" ,options={"default":false}) */ private bool $isDefault = false; /** * @ORM\OneToMany(targetEntity=Company::class, mappedBy="country") */ private $companies; public function __construct() { $this->companies = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function __toString(): string { return $this->getName(); } public function getName(): ?string { return $this->name; } public function setName(string $name): self { $this->name = $name; return $this; } public function isIsDefault(): ?bool { return $this->isDefault; } public function setIsDefault(bool $isDefault): self { $this->isDefault = $isDefault; return $this; } /** * @return Collection<int, Company> */ public function getCompanies(): Collection { return $this->companies; } public function addCompany(Company $company): self { if (!$this->companies->contains($company)) { $this->companies[] = $company; $company->setCountry($this); } return $this; } public function removeCompany(Company $company): self { if ($this->companies->removeElement($company)) { // set the owning side to null (unless already changed) if ($company->getCountry() === $this) { $company->setCountry(null); } } return $this; }}