<?php
namespace App\Entity;
use App\Repository\ParEstadoCivilRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: ParEstadoCivilRepository::class)]
class ParEstadoCivil
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $nombre = null;
#[ORM\OneToMany(mappedBy: 'estadoCivil', targetEntity: TerPersona::class)]
private Collection $persona;
public function __construct()
{
$this->persona = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getNombre(): ?string
{
return $this->nombre;
}
public function setNombre(string $nombre): static
{
$this->nombre = $nombre;
return $this;
}
/**
* @return Collection<int, TerPersona>
*/
public function getPersona(): Collection
{
return $this->persona;
}
public function addPersona(TerPersona $persona): static
{
if (!$this->persona->contains($persona)) {
$this->persona->add($persona);
$persona->setEstadoCivil($this);
}
return $this;
}
public function removePersona(TerPersona $persona): static
{
if ($this->persona->removeElement($persona)) {
// set the owning side to null (unless already changed)
if ($persona->getEstadoCivil() === $this) {
$persona->setEstadoCivil(null);
}
}
return $this;
}
}