<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use App\Validator as BcAssert;
/**
* @ORM\Entity(repositoryClass=EcommerceCabeceraRepository::class)
* @ORM\HasLifecycleCallbacks()
*/
class EcommerceCabecera
{
use Timestamp;
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $nombrecliente;
/**
* @ORM\Column(type="string", length=8, nullable=true)
*/
private $codpostalcliente;
/**
* @ORM\Column(type="string", length=255)
*/
private $direccioncliente;
/**
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $poblacioncliente;
/**
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $provinciacliente;
/**
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $paiscliente;
/**
* @ORM\Column(type="string", length=15, nullable=true)
*/
private $telefonocliente;
/**
* @ORM\Column(type="string", length=15, nullable=true)
*/
private $telefono2cliente;
/**
* @ORM\Column(type="string", length=15, nullable=true)
*/
private $movilcliente;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $emailcliente;
/**
* @ORM\Column(type="integer", nullable=true, nullable=true)
*/
private $codmonedaminuta;
/**
* @ORM\Column(type="string", length=20, nullable=true)
*/
private $nifcliente;
/**
* @ORM\Column(type="string", length=2, nullable=true)
*/
private $zona;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $fechareserva;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $codcliente;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $direccion2cliente;
// /**
// * @ORM\OneToMany(targetEntity=EcommerceLineas::class, mappedBy="ecommerce_cabecera", cascade={"persist", "remove"})
// * @ORM\OrderBy({"root" = "ASC","lft" = "ASC"})
// */
// private $lineas;
// /**
// * @ORM\ManyToOne(targetEntity=User::class, inversedBy="ecommerce_cabeceras", nullable=true)
// */
// private $user;
/**
* @ORM\Column(type="decimal", precision=10, scale=0, nullable=true)
*/
private $total;
/**
* @ORM\Column(type="string", length=20, nullable=true)
*/
private $sucursal;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $comentario;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isFinalizada;
/**
* @ORM\Column(type="string", length=20, nullable=true)
*/
private $metododepago;
/**
* @ORM\Column(type="integer")
*/
private $Tipodeservicio = 4;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $is_enviado = false;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $filename;
/**
* @ORM\OneToMany(targetEntity=EcommerceStatus::class, mappedBy="EcommerceCabecera")
*/
private $CabeceraStatus;
/**
* @ORM\Column(type="string", length=255)
*/
private $estado;
/**
* @ORM\OneToMany(targetEntity=Domicilios::class, mappedBy="ecommerce_cabecera", cascade={"remove"}, fetch="LAZY")
*/
private $domicilios;
public function __construct()
{
$this->CabeceraStatus = new ArrayCollection();
$this->domicilios = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getNombrecliente(): ?string
{
return $this->nombrecliente;
}
public function setNombrecliente(string $nombrecliente): self
{
$this->nombrecliente = $nombrecliente;
return $this;
}
public function getCodpostalcliente(): ?string
{
return $this->codpostalcliente;
}
public function setCodpostalcliente(?string $codpostalcliente): self
{
$this->codpostalcliente = $codpostalcliente;
return $this;
}
public function getDireccioncliente(): ?string
{
return $this->direccioncliente;
}
public function setDireccioncliente(string $direccioncliente): self
{
$this->direccioncliente = $direccioncliente;
return $this;
}
public function getPoblacioncliente(): ?string
{
return $this->poblacioncliente;
}
public function setPoblacioncliente(string $poblacioncliente): self
{
$this->poblacioncliente = $poblacioncliente;
return $this;
}
public function getProvinciacliente(): ?string
{
return $this->provinciacliente;
}
public function setProvinciacliente(string $provinciacliente): self
{
$this->provinciacliente = $provinciacliente;
return $this;
}
public function getPaiscliente(): ?string
{
return $this->paiscliente;
}
public function setPaiscliente(string $paiscliente): self
{
$this->paiscliente = $paiscliente;
return $this;
}
public function getTelefonocliente(): ?string
{
return $this->telefonocliente;
}
public function setTelefonocliente(string $telefonocliente): self
{
$this->telefonocliente = $telefonocliente;
return $this;
}
public function getTelefono2cliente(): ?string
{
return $this->telefono2cliente;
}
public function setTelefono2cliente(?string $telefono2cliente): self
{
$this->telefono2cliente = $telefono2cliente;
return $this;
}
public function getMovilcliente(): ?string
{
return $this->movilcliente;
}
public function setMovilcliente(?string $movilcliente): self
{
$this->movilcliente = $movilcliente;
return $this;
}
public function getEmailcliente(): ?string
{
return $this->emailcliente;
}
public function setEmailcliente(string $emailcliente): self
{
$this->emailcliente = $emailcliente;
return $this;
}
public function getCodmonedaminuta(): ?int
{
return $this->codmonedaminuta;
}
public function setCodmonedaminuta(?int $codmonedaminuta): self
{
$this->codmonedaminuta = $codmonedaminuta;
return $this;
}
public function getNifcliente(): ?string
{
return $this->nifcliente;
}
public function setNifcliente(?string $nifcliente): self
{
$this->nifcliente = $nifcliente;
return $this;
}
/**
* @ORM\PrePersist
*/
public function setNifclienteValue(): void
{
if ($this->nifcliente == '') {
$datetime = new \DateTime('now');
// $this->nifcliente = 'BC' . $datetime->format('ymdGisv');
$dayOfYear = sprintf('%03d', $datetime->format('z'));
$miliseconds = sprintf('%03d', $datetime->format('v'));
$this->nifcliente = 'BC' . $datetime->format('y') . $dayOfYear . $datetime->format('His') . $miliseconds;
}
}
public function getZona(): ?string
{
return $this->zona;
}
public function setZona(?string $zona): self
{
$this->zona = $zona;
return $this;
}
public function getFechareserva(): ?\DateTimeInterface
{
return $this->fechareserva;
}
public function setFechareserva(?\DateTimeInterface $fechareserva): self
{
$this->fechareserva = $fechareserva;
return $this;
}
public function getCodcliente(): ?int
{
return $this->codcliente;
}
public function setCodcliente(?int $codcliente): self
{
$this->codcliente = $codcliente;
return $this;
}
public function getDireccion2cliente(): ?string
{
return $this->direccion2cliente;
}
public function setDireccion2cliente(?string $direccion2cliente): self
{
$this->direccion2cliente = $direccion2cliente;
return $this;
}
// /**
// * @return Collection|Lineas[]
// */
// public function getLineas(): Collection
// {
// return $this->lineas;
// }
// public function addLinea(Lineas $linea): self
// {
// if (!$this->lineas->contains($linea)) {
// $this->lineas[] = $linea;
// $linea->setEcommerceCabecera($this);
// }
// return $this;
// }
// public function removeLinea(Lineas $linea): self
// {
// if ($this->lineas->removeElement($linea)) {
// // set the owning side to null (unless already changed)
// if ($linea->getEcommerceCabecera() === $this) {
// $linea->setEcommerceCabecera(null);
// }
// }
// return $this;
// }
// public function getUser(): ?user
// {
// return $this->user;
// }
// public function setUser(?user $user): self
// {
// $this->user = $user;
// return $this;
// }
public function getTotal(): ?string
{
return $this->total;
}
public function setTotal(?string $total): self
{
$this->total = $total;
return $this;
}
public function getSucursal(): ?string
{
return $this->sucursal;
}
public function setSucursal(?string $sucursal): self
{
$this->sucursal = $sucursal;
return $this;
}
public function getComentario(): ?string
{
return $this->comentario;
}
public function setComentario(?string $comentario): self
{
$this->comentario = $comentario;
return $this;
}
public function getIsFinalizada(): ?bool
{
return $this->isFinalizada;
}
public function setIsFinalizada(?bool $isFinalizada): self
{
$this->isFinalizada = $isFinalizada;
return $this;
}
public function getMetododepago(): ?string
{
return $this->metododepago;
}
public function setMetododepago(?string $metododepago): self
{
$this->metododepago = $metododepago;
return $this;
}
public function getTipodeservicio(): ?int
{
return $this->Tipodeservicio;
}
public function setTipodeservicio(int $Tipodeservicio): self
{
$this->Tipodeservicio = $Tipodeservicio;
return $this;
}
public function getIsEnviado(): ?bool
{
return $this->is_enviado;
}
public function setIsEnviado(?bool $is_enviado): self
{
$this->is_enviado = $is_enviado;
return $this;
}
public function getFilename(): ?string
{
return $this->filename;
}
public function setFilename(?string $filename): self
{
$this->filename = $filename;
return $this;
}
/**
* @return Collection|EcommerceStatus[]
*/
public function getCabeceraStatus(): Collection
{
return $this->CabeceraStatus;
}
public function addCabeceraStatus(EcommerceStatus $cabeceraStatus): self
{
if (!$this->CabeceraStatus->contains($cabeceraStatus)) {
$this->CabeceraStatus[] = $cabeceraStatus;
$cabeceraStatus->setEcommerceCabecera($this);
}
return $this;
}
public function removeCabeceraStatus(EcommerceStatus $cabeceraStatus): self
{
if ($this->CabeceraStatus->removeElement($cabeceraStatus)) {
// set the owning side to null (unless already changed)
if ($cabeceraStatus->getEcommerceCabecera() === $this) {
$cabeceraStatus->setEcommerceCabecera(null);
}
}
return $this;
}
public function getEstado(): ?string
{
return $this->estado;
}
public function setEstado(string $estado): self
{
$this->estado = $estado;
return $this;
}
public function getDomicilios(): ?Domicilios
{
return $this->domicilios;
}
public function setDomicilios(Domicilios $domicilios): self
{
// set the owning side of the relation if necessary
if ($domicilios->getEcommerceCabecera() !== $this) {
$domicilios->setEcommerceCabecera($this);
}
$this->domicilios = $domicilios;
return $this;
}
public function __toString(): string
{
return '(#' . $this->getid() . ') ' . $this->getDireccioncliente() . ' - ' . $this->getNombrecliente();
}
public function isIsFinalizada(): ?bool
{
return $this->isFinalizada;
}
public function isIsEnviado(): ?bool
{
return $this->is_enviado;
}
public function addDomicilio(Domicilios $domicilio): static
{
if (!$this->domicilios->contains($domicilio)) {
$this->domicilios->add($domicilio);
$domicilio->setEcommerceCabecera($this);
}
return $this;
}
public function removeDomicilio(Domicilios $domicilio): static
{
if ($this->domicilios->removeElement($domicilio)) {
// set the owning side to null (unless already changed)
if ($domicilio->getEcommerceCabecera() === $this) {
$domicilio->setEcommerceCabecera(null);
}
}
return $this;
}
}