src/Entity/Province.php line 13
<?phpnamespace App\Entity;use App\Repository\ProvinceRepository;use App\Traits\TimeStampTrait;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: ProvinceRepository::class)]#[ORM\HasLifecycleCallbacks]class Province{use TimeStampTrait;#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;#[ORM\Column(length: 100)]private ?string $code = null;#[ORM\Column(length: 30, nullable: true)]private ?string $name = null;#[ORM\Column(length: 10)]private ?string $isoCode = null;#[ORM\ManyToOne(inversedBy: 'provinces')]private ?Country $country = null;#[ORM\OneToMany(mappedBy: 'province', targetEntity: Residence::class)]private Collection $residences;public function __construct(){$this->residences = 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 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 getCountry(): ?Country{return $this->country;}public function setCountry(?Country $country): static{$this->country = $country;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->setProvince($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->getProvince() === $this) {$residence->setProvince(null);}}return $this;}public function __toString(): string{return $this->name;}}