src/Entity/Country.php line 13
<?phpnamespace App\Entity;use App\Repository\CountryRepository;use App\Traits\TimeStampTrait;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: CountryRepository::class)]#[ORM\HasLifecycleCallbacks]class Country{use TimeStampTrait;#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;#[ORM\Column(length: 100)]private ?string $code = null;#[ORM\Column(length: 10, nullable: true)]private ?string $countryCode = null;#[ORM\Column(length: 100, nullable: true)]private ?string $name = null;#[ORM\Column(length: 10, nullable: true)]private ?string $isoCode = null;#[ORM\ManyToOne(inversedBy: 'countries')]private ?User $createdBy = null;#[ORM\OneToMany(mappedBy: 'country', targetEntity: Province::class)]private Collection $provinces;#[ORM\OneToMany(mappedBy: 'country', targetEntity: Residence::class)]private Collection $residences;#[ORM\Column(nullable: true)]private ?bool $status = null;#[ORM\OneToMany(mappedBy: 'country', targetEntity: Entreprise::class)]private Collection $entreprises;#[ORM\OneToMany(mappedBy: 'country', targetEntity: User::class)]private Collection $users;public function __construct(){$this->provinces = new ArrayCollection();$this->residences = new ArrayCollection();$this->entreprises = new ArrayCollection();$this->users = new ArrayCollection();}public function getId(): ?int{return $this->id;}public function getCode(): ?string{return $this->code;}public function setCode(string $code): static{$this->code = $code;return $this;}public function getCountryCode(): ?string{return $this->countryCode;}public function setCountryCode(?string $countryCode): static{$this->countryCode = $countryCode;return $this;}public function getName(): ?string{return $this->name;}public function setName(?string $name): static{$this->name = $name;return $this;}public function getIsoCode(): ?string{return $this->isoCode;}public function setIsoCode(?string $isoCode): static{$this->isoCode = $isoCode;return $this;}public function getCreatedBy(): ?User{return $this->createdBy;}public function setCreatedBy(?User $createdBy): static{$this->createdBy = $createdBy;return $this;}/*** @return Collection<int, Province>*/public function getProvinces(): Collection{return $this->provinces;}public function addProvince(Province $province): static{if (!$this->provinces->contains($province)) {$this->provinces->add($province);$province->setCountry($this);}return $this;}public function removeProvince(Province $province): static{if ($this->provinces->removeElement($province)) {// set the owning side to null (unless already changed)if ($province->getCountry() === $this) {$province->setCountry(null);}}return $this;}/*** @return Collection<int, Residence>*/public function getResidences(): Collection{return $this->residences;}public function addResidence(Residence $residence): static{if (!$this->residences->contains($residence)) {$this->residences->add($residence);$residence->setCountry($this);}return $this;}public function removeResidence(Residence $residence): static{if ($this->residences->removeElement($residence)) {// set the owning side to null (unless already changed)if ($residence->getCountry() === $this) {$residence->setCountry(null);}}return $this;}public function __toString(): string{return $this->name;}public function isStatus(): ?bool{return $this->status;}public function setStatus(?bool $status): static{$this->status = $status;return $this;}/*** @return Collection<int, Entreprise>*/public function getEntreprises(): Collection{return $this->entreprises;}public function addEntreprise(Entreprise $entreprise): static{if (!$this->entreprises->contains($entreprise)) {$this->entreprises->add($entreprise);$entreprise->setCountry($this);}return $this;}public function removeEntreprise(Entreprise $entreprise): static{if ($this->entreprises->removeElement($entreprise)) {// set the owning side to null (unless already changed)if ($entreprise->getCountry() === $this) {$entreprise->setCountry(null);}}return $this;}/*** @return Collection<int, User>*/public function getUsers(): Collection{return $this->users;}public function addUser(User $user): static{if (!$this->users->contains($user)) {$this->users->add($user);$user->setCountry($this);}return $this;}public function removeUser(User $user): static{if ($this->users->removeElement($user)) {// set the owning side to null (unless already changed)if ($user->getCountry() === $this) {$user->setCountry(null);}}return $this;}}