<?php
namespace App\Entity;
use App\Repository\EstadoCompraFacturaRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=EstadoCompraFacturaRepository::class)
*/
class EstadoCompraFactura
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $nombre;
/**
* @ORM\OneToMany(targetEntity=Factura::class, mappedBy="estadoCompra")
*/
private $facturas;
public function __construct()
{
$this->facturas = 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<int, Factura>
*/
public function getFacturas(): Collection
{
return $this->facturas;
}
public function addFactura(Factura $factura): self
{
if (!$this->facturas->contains($factura)) {
$this->facturas[] = $factura;
$factura->setEstadoCompra($this);
}
return $this;
}
public function removeFactura(Factura $factura): self
{
if ($this->facturas->removeElement($factura)) {
// set the owning side to null (unless already changed)
if ($factura->getEstadoCompra() === $this) {
$factura->setEstadoCompra(null);
}
}
return $this;
}
public function __toString()
{
return $this->nombre;
}
}