<?php
namespace App\Entity;
use App\Repository\ClienteRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=ClienteRepository::class)
*/
class Cliente
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $nombre;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $apellido;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $apellido2;
/**
* @ORM\ManyToOne(targetEntity=TipoDocumento::class)
* @ORM\JoinColumn(nullable=false)
*/
private $tipoDocumento;
/**
* @ORM\Column(type="string", length=255)
*/
private $nif;
/**
* @ORM\Column(type="boolean")
*/
private $representante;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $nombreRepresentante;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $dniRepresentante;
/**
* @ORM\Column(type="string", length=255)
*/
private $telefono;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $telefono2;
/**
* @ORM\Column(type="string", length=255)
*/
private $email;
/**
* @ORM\ManyToOne(targetEntity=TipoVia::class)
* @ORM\JoinColumn(nullable=false)
*/
private $tipoVia;
/**
* @ORM\Column(type="string", length=255)
*/
private $nombreVia;
/**
* @ORM\Column(type="string", length=255)
*/
private $numeroDireccion;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $escalera;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $piso;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $puerta;
/**
* @ORM\Column(type="string", length=255)
*/
private $cp;
/**
* @ORM\Column(type="string", length=255)
*/
private $poblacion;
/**
* @ORM\Column(type="string", length=255)
*/
private $provincia;
/**
* @ORM\Column(type="boolean")
*/
private $notificaciones;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $nombreNotificaciones;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $direccionNotificaciones;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $poblacionNotificaciones;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $cpNotificaciones;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $provinciaNotificaciones;
/**
* @ORM\OneToMany(targetEntity=Contrato::class, mappedBy="cliente")
*/
private $contratos;
/**
* @ORM\OneToOne(targetEntity=User::class, inversedBy="cliente", cascade={"persist", "remove"})
*/
private $user;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $observaciones;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $codigoContable;
/**
* @ORM\OneToMany(targetEntity=Fraccionamiento::class, mappedBy="cliente")
*/
private $fraccionamientos;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $informacionFacturaE;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $codigoReceptor;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $codigoPagador;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $codigoFiscal;
public function __construct()
{
$this->contratos = new ArrayCollection();
$this->fraccionamientos = 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;
}
public function getApellido(): ?string
{
return $this->apellido;
}
public function setApellido(?string $apellido): self
{
$this->apellido = $apellido;
return $this;
}
public function getApellido2(): ?string
{
return $this->apellido2;
}
public function setApellido2(?string $apellido2): self
{
$this->apellido2 = $apellido2;
return $this;
}
public function getTipoDocumento(): ?TipoDocumento
{
return $this->tipoDocumento;
}
public function setTipoDocumento(?TipoDocumento $tipoDocumento): self
{
$this->tipoDocumento = $tipoDocumento;
return $this;
}
public function getNif(): ?string
{
return $this->nif;
}
public function setNif(string $nif): self
{
$this->nif = $nif;
return $this;
}
public function getRepresentante(): ?bool
{
return $this->representante;
}
public function setRepresentante(bool $representante): self
{
$this->representante = $representante;
return $this;
}
public function getNombreRepresentante(): ?string
{
return $this->nombreRepresentante;
}
public function setNombreRepresentante(?string $nombreRepresentante): self
{
$this->nombreRepresentante = $nombreRepresentante;
return $this;
}
public function getDniRepresentante(): ?string
{
return $this->dniRepresentante;
}
public function setDniRepresentante(?string $dniRepresentante): self
{
$this->dniRepresentante = $dniRepresentante;
return $this;
}
public function getTelefono(): ?string
{
return $this->telefono;
}
public function setTelefono(string $telefono): self
{
$this->telefono = $telefono;
return $this;
}
public function getTelefono2(): ?string
{
return $this->telefono2;
}
public function setTelefono2(?string $telefono2): self
{
$this->telefono2 = $telefono2;
return $this;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(string $email): self
{
$this->email = $email;
return $this;
}
public function getTipoVia(): ?TipoVia
{
return $this->tipoVia;
}
public function setTipoVia(?TipoVia $tipoVia): self
{
$this->tipoVia = $tipoVia;
return $this;
}
public function getNombreVia(): ?string
{
return $this->nombreVia;
}
public function setNombreVia(string $nombreVia): self
{
$this->nombreVia = $nombreVia;
return $this;
}
public function getNumeroDireccion(): ?string
{
return $this->numeroDireccion;
}
public function setNumeroDireccion(string $numeroDireccion): self
{
$this->numeroDireccion = $numeroDireccion;
return $this;
}
public function getEscalera(): ?string
{
return $this->escalera;
}
public function setEscalera(?string $escalera): self
{
$this->escalera = $escalera;
return $this;
}
public function getPiso(): ?string
{
return $this->piso;
}
public function setPiso(?string $piso): self
{
$this->piso = $piso;
return $this;
}
public function getPuerta(): ?string
{
return $this->puerta;
}
public function setPuerta(?string $puerta): self
{
$this->puerta = $puerta;
return $this;
}
public function getCp(): ?string
{
return $this->cp;
}
public function setCp(string $cp): self
{
$this->cp = $cp;
return $this;
}
public function getPoblacion(): ?string
{
return $this->poblacion;
}
public function setPoblacion(string $poblacion): self
{
$this->poblacion = $poblacion;
return $this;
}
public function getProvincia(): ?string
{
return $this->provincia;
}
public function setProvincia(string $provincia): self
{
$this->provincia = $provincia;
return $this;
}
public function getNotificaciones(): ?bool
{
return $this->notificaciones;
}
public function setNotificaciones(bool $notificaciones): self
{
$this->notificaciones = $notificaciones;
return $this;
}
public function getNombreNotificaciones(): ?string
{
return $this->nombreNotificaciones;
}
public function setNombreNotificaciones(?string $nombreNotificaciones): self
{
$this->nombreNotificaciones = $nombreNotificaciones;
return $this;
}
public function getDireccionNotificaciones(): ?string
{
return $this->direccionNotificaciones;
}
public function setDireccionNotificaciones(?string $direccionNotificaciones): self
{
$this->direccionNotificaciones = $direccionNotificaciones;
return $this;
}
public function getPoblacionNotificaciones(): ?string
{
return $this->poblacionNotificaciones;
}
public function setPoblacionNotificaciones(?string $poblacionNotificaciones): self
{
$this->poblacionNotificaciones = $poblacionNotificaciones;
return $this;
}
public function getCpNotificaciones(): ?string
{
return $this->cpNotificaciones;
}
public function setCpNotificaciones(?string $cpNotificaciones): self
{
$this->cpNotificaciones = $cpNotificaciones;
return $this;
}
public function getProvinciaNotificaciones(): ?string
{
return $this->provinciaNotificaciones;
}
public function setProvinciaNotificaciones(?string $provinciaNotificaciones): self
{
$this->provinciaNotificaciones = $provinciaNotificaciones;
return $this;
}/*
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): self
{
$this->user = $user;
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->setCliente($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->getCliente() === $this) {
$contrato->setCliente(null);
}
}
return $this;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): self
{
$this->user = $user;
return $this;
}
public function __toString():?string
{
$nombre=$this->nombre;
if(!empty($this->apellido)){
$nombre.=' '.$this->apellido;
}
if(!empty($this->apellido2)){
$nombre.=' '.$this->apellido2;
}
return $nombre;
}
public function getDireccion():?string
{
$direccion=$this->tipoVia->getNombre().' '.$this->nombreVia.' '.$this->numeroDireccion;
if(!empty($this->escalera)){
$direccion.=', '.$this->escalera;
}
if(!empty($this->piso)){
$direccion.=', '.$this->piso;
}
if(!empty($this->puerta)){
$direccion.=', '.$this->puerta;
}
return $direccion;
}
public function getObservaciones(): ?string
{
return $this->observaciones;
}
public function setObservaciones(?string $observaciones): self
{
$this->observaciones = $observaciones;
return $this;
}
public function getCodigoContable(): ?string
{
return $this->codigoContable;
}
public function setCodigoContable(?string $codigoContable): self
{
$this->codigoContable = $codigoContable;
return $this;
}
/**
* @return Collection<int, Fraccionamiento>
*/
public function getFraccionamientos(): Collection
{
return $this->fraccionamientos;
}
public function addFraccionamiento(Fraccionamiento $fraccionamiento): self
{
if (!$this->fraccionamientos->contains($fraccionamiento)) {
$this->fraccionamientos[] = $fraccionamiento;
$fraccionamiento->setCliente($this);
}
return $this;
}
public function removeFraccionamiento(Fraccionamiento $fraccionamiento): self
{
if ($this->fraccionamientos->removeElement($fraccionamiento)) {
// set the owning side to null (unless already changed)
if ($fraccionamiento->getCliente() === $this) {
$fraccionamiento->setCliente(null);
}
}
return $this;
}
public function isInformacionFacturaE(): ?bool
{
return $this->informacionFacturaE;
}
public function setInformacionFacturaE(?bool $informacionFacturaE): self
{
$this->informacionFacturaE = $informacionFacturaE;
return $this;
}
public function getCodigoReceptor(): ?string
{
return $this->codigoReceptor;
}
public function setCodigoReceptor(?string $codigoReceptor): self
{
$this->codigoReceptor = $codigoReceptor;
return $this;
}
public function getCodigoPagador(): ?string
{
return $this->codigoPagador;
}
public function setCodigoPagador(?string $codigoPagador): self
{
$this->codigoPagador = $codigoPagador;
return $this;
}
public function getCodigoFiscal(): ?string
{
return $this->codigoFiscal;
}
public function setCodigoFiscal(?string $codigoFiscal): self
{
$this->codigoFiscal = $codigoFiscal;
return $this;
}
}