<?php
namespace App\Entity;
use App\Repository\ParCampoRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: ParCampoRepository::class)]
class ParCampo
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $nombre = null;
#[ORM\ManyToOne(inversedBy: 'campo')]
private ?ParEstado $estado = null;
#[ORM\ManyToMany(targetEntity: JurNorma::class, mappedBy: 'campoAplicacion')]
private Collection $norma;
public function __construct()
{
$this->norma = 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;
}
public function getEstado(): ?ParEstado
{
return $this->estado;
}
public function setEstado(?ParEstado $estado): static
{
$this->estado = $estado;
return $this;
}
/**
* @return Collection<int, JurNorma>
*/
public function getNorma(): Collection
{
return $this->norma;
}
public function addNorma(JurNorma $norma): static
{
if (!$this->norma->contains($norma)) {
$this->norma->add($norma);
$norma->addCampoAplicacion($this);
}
return $this;
}
public function removeNorma(JurNorma $norma): static
{
if ($this->norma->removeElement($norma)) {
$norma->removeCampoAplicacion($this);
}
return $this;
}
}