src/Entity/Cliente.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ClienteRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=ClienteRepository::class)
  9.  */
  10. class Cliente
  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\Column(type="string", length=255, nullable=true)
  24.      */
  25.     private $apellido;
  26.     /**
  27.      * @ORM\Column(type="string", length=255, nullable=true)
  28.      */
  29.     private $apellido2;
  30.     /**
  31.      * @ORM\ManyToOne(targetEntity=TipoDocumento::class)
  32.      * @ORM\JoinColumn(nullable=false)
  33.      */
  34.     private $tipoDocumento;
  35.     /**
  36.      * @ORM\Column(type="string", length=255)
  37.      */
  38.     private $nif;
  39.     /**
  40.      * @ORM\Column(type="boolean")
  41.      */
  42.     private $representante;
  43.     /**
  44.      * @ORM\Column(type="string", length=255, nullable=true)
  45.      */
  46.     private $nombreRepresentante;
  47.     /**
  48.      * @ORM\Column(type="string", length=255, nullable=true)
  49.      */
  50.     private $dniRepresentante;
  51.     /**
  52.      * @ORM\Column(type="string", length=255)
  53.      */
  54.     private $telefono;
  55.     /**
  56.      * @ORM\Column(type="string", length=255, nullable=true)
  57.      */
  58.     private $telefono2;
  59.     /**
  60.      * @ORM\Column(type="string", length=255)
  61.      */
  62.     private $email;
  63.     /**
  64.      * @ORM\ManyToOne(targetEntity=TipoVia::class)
  65.      * @ORM\JoinColumn(nullable=false)
  66.      */
  67.     private $tipoVia;
  68.     /**
  69.      * @ORM\Column(type="string", length=255)
  70.      */
  71.     private $nombreVia;
  72.     /**
  73.      * @ORM\Column(type="string", length=255)
  74.      */
  75.     private $numeroDireccion;
  76.     /**
  77.      * @ORM\Column(type="string", length=255, nullable=true)
  78.      */
  79.     private $escalera;
  80.     /**
  81.      * @ORM\Column(type="string", length=255, nullable=true)
  82.      */
  83.     private $piso;
  84.     /**
  85.      * @ORM\Column(type="string", length=255, nullable=true)
  86.      */
  87.     private $puerta;
  88.     /**
  89.      * @ORM\Column(type="string", length=255)
  90.      */
  91.     private $cp;
  92.     /**
  93.      * @ORM\Column(type="string", length=255)
  94.      */
  95.     private $poblacion;
  96.     /**
  97.      * @ORM\Column(type="string", length=255)
  98.      */
  99.     private $provincia;
  100.     /**
  101.      * @ORM\Column(type="boolean")
  102.      */
  103.     private $notificaciones;
  104.     /**
  105.      * @ORM\Column(type="string", length=255, nullable=true)
  106.      */
  107.     private $nombreNotificaciones;
  108.     /**
  109.      * @ORM\Column(type="string", length=255, nullable=true)
  110.      */
  111.     private $direccionNotificaciones;
  112.     /**
  113.      * @ORM\Column(type="string", length=255, nullable=true)
  114.      */
  115.     private $poblacionNotificaciones;
  116.     /**
  117.      * @ORM\Column(type="string", length=255, nullable=true)
  118.      */
  119.     private $cpNotificaciones;
  120.     /**
  121.      * @ORM\Column(type="string", length=255, nullable=true)
  122.      */
  123.     private $provinciaNotificaciones;
  124.     /**
  125.      * @ORM\OneToMany(targetEntity=Contrato::class, mappedBy="cliente")
  126.      */
  127.     private $contratos;
  128.     /**
  129.      * @ORM\OneToOne(targetEntity=User::class, inversedBy="cliente", cascade={"persist", "remove"})
  130.      */
  131.     private $user;
  132.     /**
  133.      * @ORM\Column(type="string", length=255, nullable=true)
  134.      */
  135.     private $observaciones;
  136.     /**
  137.      * @ORM\Column(type="string", length=255, nullable=true)
  138.      */
  139.     private $codigoContable;
  140.     /**
  141.      * @ORM\OneToMany(targetEntity=Fraccionamiento::class, mappedBy="cliente")
  142.      */
  143.     private $fraccionamientos;
  144.     /**
  145.      * @ORM\Column(type="boolean", nullable=true)
  146.      */
  147.     private $informacionFacturaE;
  148.     /**
  149.      * @ORM\Column(type="string", length=255, nullable=true)
  150.      */
  151.     private $codigoReceptor;
  152.     /**
  153.      * @ORM\Column(type="string", length=255, nullable=true)
  154.      */
  155.     private $codigoPagador;
  156.     /**
  157.      * @ORM\Column(type="string", length=255, nullable=true)
  158.      */
  159.     private $codigoFiscal;
  160.     public function __construct()
  161.     {
  162.         $this->contratos = new ArrayCollection();
  163.         $this->fraccionamientos = new ArrayCollection();
  164.     }
  165.     public function getId(): ?int
  166.     {
  167.         return $this->id;
  168.     }
  169.     public function getNombre(): ?string
  170.     {
  171.         return $this->nombre;
  172.     }
  173.     public function setNombre(string $nombre): self
  174.     {
  175.         $this->nombre $nombre;
  176.         return $this;
  177.     }
  178.     public function getApellido(): ?string
  179.     {
  180.         return $this->apellido;
  181.     }
  182.     public function setApellido(?string $apellido): self
  183.     {
  184.         $this->apellido $apellido;
  185.         return $this;
  186.     }
  187.     public function getApellido2(): ?string
  188.     {
  189.         return $this->apellido2;
  190.     }
  191.     public function setApellido2(?string $apellido2): self
  192.     {
  193.         $this->apellido2 $apellido2;
  194.         return $this;
  195.     }
  196.     public function getTipoDocumento(): ?TipoDocumento
  197.     {
  198.         return $this->tipoDocumento;
  199.     }
  200.     public function setTipoDocumento(?TipoDocumento $tipoDocumento): self
  201.     {
  202.         $this->tipoDocumento $tipoDocumento;
  203.         return $this;
  204.     }
  205.     public function getNif(): ?string
  206.     {
  207.         return $this->nif;
  208.     }
  209.     public function setNif(string $nif): self
  210.     {
  211.         $this->nif $nif;
  212.         return $this;
  213.     }
  214.     public function getRepresentante(): ?bool
  215.     {
  216.         return $this->representante;
  217.     }
  218.     public function setRepresentante(bool $representante): self
  219.     {
  220.         $this->representante $representante;
  221.         return $this;
  222.     }
  223.     public function getNombreRepresentante(): ?string
  224.     {
  225.         return $this->nombreRepresentante;
  226.     }
  227.     public function setNombreRepresentante(?string $nombreRepresentante): self
  228.     {
  229.         $this->nombreRepresentante $nombreRepresentante;
  230.         return $this;
  231.     }
  232.     public function getDniRepresentante(): ?string
  233.     {
  234.         return $this->dniRepresentante;
  235.     }
  236.     public function setDniRepresentante(?string $dniRepresentante): self
  237.     {
  238.         $this->dniRepresentante $dniRepresentante;
  239.         return $this;
  240.     }
  241.     public function getTelefono(): ?string
  242.     {
  243.         return $this->telefono;
  244.     }
  245.     public function setTelefono(string $telefono): self
  246.     {
  247.         $this->telefono $telefono;
  248.         return $this;
  249.     }
  250.     public function getTelefono2(): ?string
  251.     {
  252.         return $this->telefono2;
  253.     }
  254.     public function setTelefono2(?string $telefono2): self
  255.     {
  256.         $this->telefono2 $telefono2;
  257.         return $this;
  258.     }
  259.     public function getEmail(): ?string
  260.     {
  261.         return $this->email;
  262.     }
  263.     public function setEmail(string $email): self
  264.     {
  265.         $this->email $email;
  266.         return $this;
  267.     }
  268.     public function getTipoVia(): ?TipoVia
  269.     {
  270.         return $this->tipoVia;
  271.     }
  272.     public function setTipoVia(?TipoVia $tipoVia): self
  273.     {
  274.         $this->tipoVia $tipoVia;
  275.         return $this;
  276.     }
  277.     public function getNombreVia(): ?string
  278.     {
  279.         return $this->nombreVia;
  280.     }
  281.     public function setNombreVia(string $nombreVia): self
  282.     {
  283.         $this->nombreVia $nombreVia;
  284.         return $this;
  285.     }
  286.     public function getNumeroDireccion(): ?string
  287.     {
  288.         return $this->numeroDireccion;
  289.     }
  290.     public function setNumeroDireccion(string $numeroDireccion): self
  291.     {
  292.         $this->numeroDireccion $numeroDireccion;
  293.         return $this;
  294.     }
  295.     public function getEscalera(): ?string
  296.     {
  297.         return $this->escalera;
  298.     }
  299.     public function setEscalera(?string $escalera): self
  300.     {
  301.         $this->escalera $escalera;
  302.         return $this;
  303.     }
  304.     public function getPiso(): ?string
  305.     {
  306.         return $this->piso;
  307.     }
  308.     public function setPiso(?string $piso): self
  309.     {
  310.         $this->piso $piso;
  311.         return $this;
  312.     }
  313.     public function getPuerta(): ?string
  314.     {
  315.         return $this->puerta;
  316.     }
  317.     public function setPuerta(?string $puerta): self
  318.     {
  319.         $this->puerta $puerta;
  320.         return $this;
  321.     }
  322.     public function getCp(): ?string
  323.     {
  324.         return $this->cp;
  325.     }
  326.     public function setCp(string $cp): self
  327.     {
  328.         $this->cp $cp;
  329.         return $this;
  330.     }
  331.     public function getPoblacion(): ?string
  332.     {
  333.         return $this->poblacion;
  334.     }
  335.     public function setPoblacion(string $poblacion): self
  336.     {
  337.         $this->poblacion $poblacion;
  338.         return $this;
  339.     }
  340.     public function getProvincia(): ?string
  341.     {
  342.         return $this->provincia;
  343.     }
  344.     public function setProvincia(string $provincia): self
  345.     {
  346.         $this->provincia $provincia;
  347.         return $this;
  348.     }
  349.     public function getNotificaciones(): ?bool
  350.     {
  351.         return $this->notificaciones;
  352.     }
  353.     public function setNotificaciones(bool $notificaciones): self
  354.     {
  355.         $this->notificaciones $notificaciones;
  356.         return $this;
  357.     }
  358.     public function getNombreNotificaciones(): ?string
  359.     {
  360.         return $this->nombreNotificaciones;
  361.     }
  362.     public function setNombreNotificaciones(?string $nombreNotificaciones): self
  363.     {
  364.         $this->nombreNotificaciones $nombreNotificaciones;
  365.         return $this;
  366.     }
  367.     public function getDireccionNotificaciones(): ?string
  368.     {
  369.         return $this->direccionNotificaciones;
  370.     }
  371.     public function setDireccionNotificaciones(?string $direccionNotificaciones): self
  372.     {
  373.         $this->direccionNotificaciones $direccionNotificaciones;
  374.         return $this;
  375.     }
  376.     public function getPoblacionNotificaciones(): ?string
  377.     {
  378.         return $this->poblacionNotificaciones;
  379.     }
  380.     public function setPoblacionNotificaciones(?string $poblacionNotificaciones): self
  381.     {
  382.         $this->poblacionNotificaciones $poblacionNotificaciones;
  383.         return $this;
  384.     }
  385.     public function getCpNotificaciones(): ?string
  386.     {
  387.         return $this->cpNotificaciones;
  388.     }
  389.     public function setCpNotificaciones(?string $cpNotificaciones): self
  390.     {
  391.         $this->cpNotificaciones $cpNotificaciones;
  392.         return $this;
  393.     }
  394.     public function getProvinciaNotificaciones(): ?string
  395.     {
  396.         return $this->provinciaNotificaciones;
  397.     }
  398.     public function setProvinciaNotificaciones(?string $provinciaNotificaciones): self
  399.     {
  400.         $this->provinciaNotificaciones $provinciaNotificaciones;
  401.         return $this;
  402.     }/*
  403.     public function getUser(): ?User
  404.     {
  405.         return $this->user;
  406.     }
  407.     public function setUser(?User $user): self
  408.     {
  409.         $this->user = $user;
  410.         return $this;
  411.     }*/
  412.     /**
  413.      * @return Collection|Contrato[]
  414.      */
  415.     public function getContratos(): Collection
  416.     {
  417.         return $this->contratos;
  418.     }
  419.     public function addContrato(Contrato $contrato): self
  420.     {
  421.         if (!$this->contratos->contains($contrato)) {
  422.             $this->contratos[] = $contrato;
  423.             $contrato->setCliente($this);
  424.         }
  425.         return $this;
  426.     }
  427.     public function removeContrato(Contrato $contrato): self
  428.     {
  429.         if ($this->contratos->contains($contrato)) {
  430.             $this->contratos->removeElement($contrato);
  431.             // set the owning side to null (unless already changed)
  432.             if ($contrato->getCliente() === $this) {
  433.                 $contrato->setCliente(null);
  434.             }
  435.         }
  436.         return $this;
  437.     }
  438.     public function getUser(): ?User
  439.     {
  440.         return $this->user;
  441.     }
  442.     public function setUser(?User $user): self
  443.     {
  444.         $this->user $user;
  445.         return $this;
  446.     }
  447.     public function __toString():?string
  448.     {
  449.         $nombre=$this->nombre;
  450.         if(!empty($this->apellido)){
  451.             $nombre.=' '.$this->apellido;
  452.         }
  453.         if(!empty($this->apellido2)){
  454.             $nombre.=' '.$this->apellido2;
  455.         }
  456.         return $nombre;
  457.     }
  458.     public function getDireccion():?string
  459.     {
  460.         $direccion=$this->tipoVia->getNombre().' '.$this->nombreVia.' '.$this->numeroDireccion;
  461.         if(!empty($this->escalera)){
  462.             $direccion.=', '.$this->escalera;
  463.         }
  464.         if(!empty($this->piso)){
  465.             $direccion.=', '.$this->piso;
  466.         }
  467.         if(!empty($this->puerta)){
  468.             $direccion.=', '.$this->puerta;
  469.         }
  470.         return $direccion;
  471.     }
  472.     public function getObservaciones(): ?string
  473.     {
  474.         return $this->observaciones;
  475.     }
  476.     public function setObservaciones(?string $observaciones): self
  477.     {
  478.         $this->observaciones $observaciones;
  479.         return $this;
  480.     }
  481.     public function getCodigoContable(): ?string
  482.     {
  483.         return $this->codigoContable;
  484.     }
  485.     public function setCodigoContable(?string $codigoContable): self
  486.     {
  487.         $this->codigoContable $codigoContable;
  488.         return $this;
  489.     }
  490.     /**
  491.      * @return Collection<int, Fraccionamiento>
  492.      */
  493.     public function getFraccionamientos(): Collection
  494.     {
  495.         return $this->fraccionamientos;
  496.     }
  497.     public function addFraccionamiento(Fraccionamiento $fraccionamiento): self
  498.     {
  499.         if (!$this->fraccionamientos->contains($fraccionamiento)) {
  500.             $this->fraccionamientos[] = $fraccionamiento;
  501.             $fraccionamiento->setCliente($this);
  502.         }
  503.         return $this;
  504.     }
  505.     public function removeFraccionamiento(Fraccionamiento $fraccionamiento): self
  506.     {
  507.         if ($this->fraccionamientos->removeElement($fraccionamiento)) {
  508.             // set the owning side to null (unless already changed)
  509.             if ($fraccionamiento->getCliente() === $this) {
  510.                 $fraccionamiento->setCliente(null);
  511.             }
  512.         }
  513.         return $this;
  514.     }
  515.     public function isInformacionFacturaE(): ?bool
  516.     {
  517.         return $this->informacionFacturaE;
  518.     }
  519.     public function setInformacionFacturaE(?bool $informacionFacturaE): self
  520.     {
  521.         $this->informacionFacturaE $informacionFacturaE;
  522.         return $this;
  523.     }
  524.     public function getCodigoReceptor(): ?string
  525.     {
  526.         return $this->codigoReceptor;
  527.     }
  528.     public function setCodigoReceptor(?string $codigoReceptor): self
  529.     {
  530.         $this->codigoReceptor $codigoReceptor;
  531.         return $this;
  532.     }
  533.     public function getCodigoPagador(): ?string
  534.     {
  535.         return $this->codigoPagador;
  536.     }
  537.     public function setCodigoPagador(?string $codigoPagador): self
  538.     {
  539.         $this->codigoPagador $codigoPagador;
  540.         return $this;
  541.     }
  542.     public function getCodigoFiscal(): ?string
  543.     {
  544.         return $this->codigoFiscal;
  545.     }
  546.     public function setCodigoFiscal(?string $codigoFiscal): self
  547.     {
  548.         $this->codigoFiscal $codigoFiscal;
  549.         return $this;
  550.     }
  551. }