<?phpnamespace App\Entity;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;/** * @ORM\Entity(repositoryClass="App\Repository\CountryRepository") */class Country{ /** * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=2, unique=true) */ private $code; /** * @ORM\Column(type="string", length=255) */ private $name; /** * @ORM\Column(type="boolean") */ private $is_eu; /** * @ORM\Column(type="boolean") */ private $is_active = true; /** * @ORM\OneToMany(targetEntity="App\Entity\User", mappedBy="Country") */ private $users; /** * @ORM\OneToMany(targetEntity="App\Entity\Payment", mappedBy="country") */ private $payments; /** * Country constructor. * @param $id * @param $code * @param $name * @param $is_eu */ public function __construct($code, $name, $is_eu) { $this->code = $code; $this->name = $name; $this->is_eu = $is_eu; $this->users = new ArrayCollection(); $this->payments = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getCode(): ?string { return $this->code; } public function setCode(string $code): self { $this->code = $code; return $this; } public function getName(): ?string { return $this->name; } public function setName(string $name): self { $this->name = $name; return $this; } public function getIsEu(): ?bool { return $this->is_eu; } public function setIsEu(bool $is_eu): self { $this->is_eu = $is_eu; return $this; } public function getIsActive(): ?bool { return $this->is_active; } public function setIsActive(bool $is_active): self { $this->is_active = $is_active; return $this; } /** * @return Collection|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->contains($user)) { $this->users->removeElement($user); // set the owning side to null (unless already changed) if ($user->getCountry() === $this) { $user->setCountry(null); } } return $this; } /** * @return Collection|Payment[] */ public function getPayments(): Collection { return $this->payments; } public function addPayment(Payment $payment): self { if (!$this->payments->contains($payment)) { $this->payments[] = $payment; $payment->setCountry($this); } return $this; } public function removePayment(Payment $payment): self { if ($this->payments->contains($payment)) { $this->payments->removeElement($payment); // set the owning side to null (unless already changed) if ($payment->getCountry() === $this) { $payment->setCountry(null); } } return $this; }}