<?php
namespace App\Entity;
use App\Repository\EstadoRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=EstadoRepository::class)
*/
class Estado
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $nombre;
/**
* @ORM\OneToMany(targetEntity=Contrato::class, mappedBy="estado")
*/
private $contratos;
public function __construct()
{
$this->contratos = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getNombre(): ?string
{
return $this->nombre;
}
public function setNombre(string $nombre): self
{
$this->nombre = $nombre;
return $this;
}
/**
* @return Collection|Contrato[]
*/
public function getContratos(): Collection
{
return $this->contratos;
}
public function addContrato(Contrato $contrato): self
{
if (!$this->contratos->contains($contrato)) {
$this->contratos[] = $contrato;
$contrato->setEstado($this);
}
return $this;
}
public function removeContrato(Contrato $contrato): self
{
if ($this->contratos->contains($contrato)) {
$this->contratos->removeElement($contrato);
// set the owning side to null (unless already changed)
if ($contrato->getEstado() === $this) {
$contrato->setEstado(null);
}
}
return $this;
}
public function __toString()
{
return $this->nombre;
}
}