src/Entity/TipoLectura.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\TipoLecturaRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=TipoLecturaRepository::class)
  9.  */
  10. class TipoLectura
  11. {
  12.     /**
  13.      * @ORM\Id()
  14.      * @ORM\GeneratedValue()
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=255)
  20.      */
  21.     private $nombre;
  22.     /**
  23.      * @ORM\OneToMany(targetEntity=Contrato::class, mappedBy="tipoLectura")
  24.      */
  25.     private $contratos;
  26.     /**
  27.      * @ORM\OneToMany(targetEntity=Factura::class, mappedBy="tipoLectura")
  28.      */
  29.     private $facturas;
  30.     /**
  31.      * @ORM\OneToMany(targetEntity=Factura::class, mappedBy="tipoLecturaAnterior")
  32.      */
  33.     private $facturasAnteriores;
  34.     public function __construct()
  35.     {
  36.         $this->contratos = new ArrayCollection();
  37.         $this->facturas = new ArrayCollection();
  38.     }
  39.     public function getId(): ?int
  40.     {
  41.         return $this->id;
  42.     }
  43.     public function getNombre(): ?string
  44.     {
  45.         return $this->nombre;
  46.     }
  47.     public function setNombre(string $nombre): self
  48.     {
  49.         $this->nombre $nombre;
  50.         return $this;
  51.     }
  52.     /**
  53.      * @return Collection|Contrato[]
  54.      */
  55.     public function getContratos(): Collection
  56.     {
  57.         return $this->contratos;
  58.     }
  59.     public function addContrato(Contrato $contrato): self
  60.     {
  61.         if (!$this->contratos->contains($contrato)) {
  62.             $this->contratos[] = $contrato;
  63.             $contrato->setTipoLectura($this);
  64.         }
  65.         return $this;
  66.     }
  67.     public function removeContrato(Contrato $contrato): self
  68.     {
  69.         if ($this->contratos->contains($contrato)) {
  70.             $this->contratos->removeElement($contrato);
  71.             // set the owning side to null (unless already changed)
  72.             if ($contrato->getTipoLectura() === $this) {
  73.                 $contrato->setTipoLectura(null);
  74.             }
  75.         }
  76.         return $this;
  77.     }
  78.     /**
  79.      * @return Collection|Factura[]
  80.      */
  81.     public function getFacturas(): Collection
  82.     {
  83.         return $this->facturas;
  84.     }
  85.     public function addFactura(Factura $factura): self
  86.     {
  87.         if (!$this->facturas->contains($factura)) {
  88.             $this->facturas[] = $factura;
  89.             $factura->setTipoLectura($this);
  90.         }
  91.         return $this;
  92.     }
  93.     public function removeFactura(Factura $factura): self
  94.     {
  95.         if ($this->facturas->contains($factura)) {
  96.             $this->facturas->removeElement($factura);
  97.             // set the owning side to null (unless already changed)
  98.             if ($factura->getTipoLectura() === $this) {
  99.                 $factura->setTipoLectura(null);
  100.             }
  101.         }
  102.         return $this;
  103.     }
  104.     public function __toString():?string
  105.     {
  106.         return $this->nombre;
  107.     }
  108. }