<?php
namespace App\Entity;
use App\Repository\ParNivelCargoRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: ParNivelCargoRepository::class)]
class ParNivelCargo
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 100)]
private ?string $nombre = null;
#[ORM\ManyToMany(targetEntity: TerPersona::class, mappedBy: 'nivelCargo')]
private Collection $persona;
public function __construct()
{
$this->persona = new ArrayCollection();
}
public function __toString() {
return $this->getNombre();
}
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->addNivelCargo($this);
}
return $this;
}
public function removePersona(TerPersona $persona): static
{
if ($this->persona->removeElement($persona)) {
$persona->removeNivelCargo($this);
}
return $this;
}
}