src/Entity/EcommerceCabecera.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\DBAL\Types\Types;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use App\Validator as BcAssert;
  8. /**
  9.  * @ORM\Entity(repositoryClass=EcommerceCabeceraRepository::class)
  10.  * @ORM\HasLifecycleCallbacks()
  11.  */
  12. class EcommerceCabecera
  13. {
  14.     use Timestamp;
  15.     /**
  16.      * @ORM\Id
  17.      * @ORM\GeneratedValue
  18.      * @ORM\Column(type="integer")
  19.      */
  20.     private $id;
  21.     /**
  22.      * @ORM\Column(type="string", length=255, nullable=true)
  23.      */
  24.     private $nombrecliente;
  25.     /**
  26.      * @ORM\Column(type="string", length=8, nullable=true)
  27.      */
  28.     private $codpostalcliente;
  29.     /**
  30.      * @ORM\Column(type="string", length=255)
  31.      */
  32.     private $direccioncliente;
  33.     /**
  34.      * @ORM\Column(type="string", length=100, nullable=true)
  35.      */
  36.     private $poblacioncliente;
  37.     /**
  38.      * @ORM\Column(type="string", length=100, nullable=true)
  39.      */
  40.     private $provinciacliente;
  41.     /**
  42.      * @ORM\Column(type="string", length=100, nullable=true)
  43.      */
  44.     private $paiscliente;
  45.     /**
  46.      * @ORM\Column(type="string", length=15, nullable=true)
  47.      */
  48.     private $telefonocliente;
  49.     /**
  50.      * @ORM\Column(type="string", length=15, nullable=true)
  51.      */
  52.     private $telefono2cliente;
  53.     /**
  54.      * @ORM\Column(type="string", length=15, nullable=true)
  55.      */
  56.     private $movilcliente;
  57.     /**
  58.      * @ORM\Column(type="string", length=255, nullable=true)
  59.      */
  60.     private $emailcliente;
  61.     /**
  62.      * @ORM\Column(type="integer", nullable=true, nullable=true)
  63.      */
  64.     private $codmonedaminuta;
  65.     /**
  66.      * @ORM\Column(type="string", length=20, nullable=true)
  67.      */
  68.     private $nifcliente;
  69.     /**
  70.      * @ORM\Column(type="string", length=2, nullable=true)
  71.      */
  72.     private $zona;
  73.     /**
  74.      * @ORM\Column(type="datetime", nullable=true)
  75.      */
  76.     private $fechareserva;
  77.     /**
  78.      * @ORM\Column(type="integer", nullable=true)
  79.      */
  80.     private $codcliente;
  81.     /**
  82.      * @ORM\Column(type="string", length=255, nullable=true)
  83.      */
  84.     private $direccion2cliente;
  85.     // /**
  86.     //  * @ORM\OneToMany(targetEntity=EcommerceLineas::class, mappedBy="ecommerce_cabecera", cascade={"persist", "remove"})
  87.     //  * @ORM\OrderBy({"root" = "ASC","lft" = "ASC"})
  88.     //  */
  89.     // private $lineas;
  90.     // /**
  91.     //  * @ORM\ManyToOne(targetEntity=User::class, inversedBy="ecommerce_cabeceras", nullable=true)
  92.     //  */
  93.     // private $user;
  94.     /**
  95.      * @ORM\Column(type="decimal", precision=10, scale=0, nullable=true)
  96.      */
  97.     private $total;
  98.     /**
  99.      * @ORM\Column(type="string", length=20, nullable=true)
  100.      */
  101.     private $sucursal;
  102.     /**
  103.      * @ORM\Column(type="text", nullable=true)
  104.      */
  105.     private $comentario;
  106.     /**
  107.      * @ORM\Column(type="boolean", nullable=true)
  108.      */
  109.     private $isFinalizada;
  110.     /**
  111.      * @ORM\Column(type="string", length=20, nullable=true)
  112.      */
  113.     private $metododepago;
  114.     /**
  115.      * @ORM\Column(type="integer")
  116.      */
  117.     private $Tipodeservicio 4;
  118.     /**
  119.      * @ORM\Column(type="boolean", nullable=true)
  120.      */
  121.     private $is_enviado false;
  122.     /**
  123.      * @ORM\Column(type="string", length=255, nullable=true)
  124.      */
  125.     private $filename;
  126.     /**
  127.      * @ORM\OneToMany(targetEntity=EcommerceStatus::class, mappedBy="EcommerceCabecera")
  128.      */
  129.     private $CabeceraStatus;
  130.     /**
  131.      * @ORM\Column(type="string", length=255)
  132.      */
  133.     private $estado;
  134.     /**
  135.      * @ORM\OneToMany(targetEntity=Domicilios::class, mappedBy="ecommerce_cabecera", cascade={"remove"}, fetch="LAZY")
  136.      */
  137.     private $domicilios;
  138.     public function __construct()
  139.     {
  140.         $this->CabeceraStatus = new ArrayCollection();
  141.         $this->domicilios = new ArrayCollection();
  142.     }
  143.     public function getId(): ?int
  144.     {
  145.         return $this->id;
  146.     }
  147.     public function getNombrecliente(): ?string
  148.     {
  149.         return $this->nombrecliente;
  150.     }
  151.     public function setNombrecliente(string $nombrecliente): self
  152.     {
  153.         $this->nombrecliente $nombrecliente;
  154.         return $this;
  155.     }
  156.     public function getCodpostalcliente(): ?string
  157.     {
  158.         return $this->codpostalcliente;
  159.     }
  160.     public function setCodpostalcliente(?string $codpostalcliente): self
  161.     {
  162.         $this->codpostalcliente $codpostalcliente;
  163.         return $this;
  164.     }
  165.     public function getDireccioncliente(): ?string
  166.     {
  167.         return $this->direccioncliente;
  168.     }
  169.     public function setDireccioncliente(string $direccioncliente): self
  170.     {
  171.         $this->direccioncliente $direccioncliente;
  172.         return $this;
  173.     }
  174.     public function getPoblacioncliente(): ?string
  175.     {
  176.         return $this->poblacioncliente;
  177.     }
  178.     public function setPoblacioncliente(string $poblacioncliente): self
  179.     {
  180.         $this->poblacioncliente $poblacioncliente;
  181.         return $this;
  182.     }
  183.     public function getProvinciacliente(): ?string
  184.     {
  185.         return $this->provinciacliente;
  186.     }
  187.     public function setProvinciacliente(string $provinciacliente): self
  188.     {
  189.         $this->provinciacliente $provinciacliente;
  190.         return $this;
  191.     }
  192.     public function getPaiscliente(): ?string
  193.     {
  194.         return $this->paiscliente;
  195.     }
  196.     public function setPaiscliente(string $paiscliente): self
  197.     {
  198.         $this->paiscliente $paiscliente;
  199.         return $this;
  200.     }
  201.     public function getTelefonocliente(): ?string
  202.     {
  203.         return $this->telefonocliente;
  204.     }
  205.     public function setTelefonocliente(string $telefonocliente): self
  206.     {
  207.         $this->telefonocliente $telefonocliente;
  208.         return $this;
  209.     }
  210.     public function getTelefono2cliente(): ?string
  211.     {
  212.         return $this->telefono2cliente;
  213.     }
  214.     public function setTelefono2cliente(?string $telefono2cliente): self
  215.     {
  216.         $this->telefono2cliente $telefono2cliente;
  217.         return $this;
  218.     }
  219.     public function getMovilcliente(): ?string
  220.     {
  221.         return $this->movilcliente;
  222.     }
  223.     public function setMovilcliente(?string $movilcliente): self
  224.     {
  225.         $this->movilcliente $movilcliente;
  226.         return $this;
  227.     }
  228.     public function getEmailcliente(): ?string
  229.     {
  230.         return $this->emailcliente;
  231.     }
  232.     public function setEmailcliente(string $emailcliente): self
  233.     {
  234.         $this->emailcliente $emailcliente;
  235.         return $this;
  236.     }
  237.     public function getCodmonedaminuta(): ?int
  238.     {
  239.         return $this->codmonedaminuta;
  240.     }
  241.     public function setCodmonedaminuta(?int $codmonedaminuta): self
  242.     {
  243.         $this->codmonedaminuta $codmonedaminuta;
  244.         return $this;
  245.     }
  246.     public function getNifcliente(): ?string
  247.     {
  248.         return $this->nifcliente;
  249.     }
  250.     public function setNifcliente(?string $nifcliente): self
  251.     {
  252.         $this->nifcliente $nifcliente;
  253.         return $this;
  254.     }
  255.     /**
  256.      * @ORM\PrePersist
  257.      */
  258.     public function setNifclienteValue(): void
  259.     {
  260.         if ($this->nifcliente == '') {
  261.             $datetime = new \DateTime('now');
  262.             // $this->nifcliente = 'BC' . $datetime->format('ymdGisv');
  263.             $dayOfYear sprintf('%03d'$datetime->format('z'));
  264.             $miliseconds sprintf('%03d'$datetime->format('v'));
  265.             $this->nifcliente 'BC' $datetime->format('y') . $dayOfYear $datetime->format('His') . $miliseconds;
  266.         }
  267.     }
  268.     public function getZona(): ?string
  269.     {
  270.         return $this->zona;
  271.     }
  272.     public function setZona(?string $zona): self
  273.     {
  274.         $this->zona $zona;
  275.         return $this;
  276.     }
  277.     public function getFechareserva(): ?\DateTimeInterface
  278.     {
  279.         return $this->fechareserva;
  280.     }
  281.     public function setFechareserva(?\DateTimeInterface $fechareserva): self
  282.     {
  283.         $this->fechareserva $fechareserva;
  284.         return $this;
  285.     }
  286.     public function getCodcliente(): ?int
  287.     {
  288.         return $this->codcliente;
  289.     }
  290.     public function setCodcliente(?int $codcliente): self
  291.     {
  292.         $this->codcliente $codcliente;
  293.         return $this;
  294.     }
  295.     public function getDireccion2cliente(): ?string
  296.     {
  297.         return $this->direccion2cliente;
  298.     }
  299.     public function setDireccion2cliente(?string $direccion2cliente): self
  300.     {
  301.         $this->direccion2cliente $direccion2cliente;
  302.         return $this;
  303.     }
  304.     // /**
  305.     //  * @return Collection|Lineas[]
  306.     //  */
  307.     // public function getLineas(): Collection
  308.     // {
  309.     //     return $this->lineas;
  310.     // }
  311.     // public function addLinea(Lineas $linea): self
  312.     // {
  313.     //     if (!$this->lineas->contains($linea)) {
  314.     //         $this->lineas[] = $linea;
  315.     //         $linea->setEcommerceCabecera($this);
  316.     //     }
  317.     //     return $this;
  318.     // }
  319.     // public function removeLinea(Lineas $linea): self
  320.     // {
  321.     //     if ($this->lineas->removeElement($linea)) {
  322.     //         // set the owning side to null (unless already changed)
  323.     //         if ($linea->getEcommerceCabecera() === $this) {
  324.     //             $linea->setEcommerceCabecera(null);
  325.     //         }
  326.     //     }
  327.     //     return $this;
  328.     // }
  329.     // public function getUser(): ?user
  330.     // {
  331.     //     return $this->user;
  332.     // }
  333.     // public function setUser(?user $user): self
  334.     // {
  335.     //     $this->user = $user;
  336.     //     return $this;
  337.     // }
  338.     public function getTotal(): ?string
  339.     {
  340.         return $this->total;
  341.     }
  342.     public function setTotal(?string $total): self
  343.     {
  344.         $this->total $total;
  345.         return $this;
  346.     }
  347.     public function getSucursal(): ?string
  348.     {
  349.         return $this->sucursal;
  350.     }
  351.     public function setSucursal(?string $sucursal): self
  352.     {
  353.         $this->sucursal $sucursal;
  354.         return $this;
  355.     }
  356.     public function getComentario(): ?string
  357.     {
  358.         return $this->comentario;
  359.     }
  360.     public function setComentario(?string $comentario): self
  361.     {
  362.         $this->comentario $comentario;
  363.         return $this;
  364.     }
  365.     public function getIsFinalizada(): ?bool
  366.     {
  367.         return $this->isFinalizada;
  368.     }
  369.     public function setIsFinalizada(?bool $isFinalizada): self
  370.     {
  371.         $this->isFinalizada $isFinalizada;
  372.         return $this;
  373.     }
  374.     public function getMetododepago(): ?string
  375.     {
  376.         return $this->metododepago;
  377.     }
  378.     public function setMetododepago(?string $metododepago): self
  379.     {
  380.         $this->metododepago $metododepago;
  381.         return $this;
  382.     }
  383.     public function getTipodeservicio(): ?int
  384.     {
  385.         return $this->Tipodeservicio;
  386.     }
  387.     public function setTipodeservicio(int $Tipodeservicio): self
  388.     {
  389.         $this->Tipodeservicio $Tipodeservicio;
  390.         return $this;
  391.     }
  392.     public function getIsEnviado(): ?bool
  393.     {
  394.         return $this->is_enviado;
  395.     }
  396.     public function setIsEnviado(?bool $is_enviado): self
  397.     {
  398.         $this->is_enviado $is_enviado;
  399.         return $this;
  400.     }
  401.     public function getFilename(): ?string
  402.     {
  403.         return $this->filename;
  404.     }
  405.     public function setFilename(?string $filename): self
  406.     {
  407.         $this->filename $filename;
  408.         return $this;
  409.     }
  410.     /**
  411.      * @return Collection|EcommerceStatus[]
  412.      */
  413.     public function getCabeceraStatus(): Collection
  414.     {
  415.         return $this->CabeceraStatus;
  416.     }
  417.     public function addCabeceraStatus(EcommerceStatus $cabeceraStatus): self
  418.     {
  419.         if (!$this->CabeceraStatus->contains($cabeceraStatus)) {
  420.             $this->CabeceraStatus[] = $cabeceraStatus;
  421.             $cabeceraStatus->setEcommerceCabecera($this);
  422.         }
  423.         return $this;
  424.     }
  425.     public function removeCabeceraStatus(EcommerceStatus $cabeceraStatus): self
  426.     {
  427.         if ($this->CabeceraStatus->removeElement($cabeceraStatus)) {
  428.             // set the owning side to null (unless already changed)
  429.             if ($cabeceraStatus->getEcommerceCabecera() === $this) {
  430.                 $cabeceraStatus->setEcommerceCabecera(null);
  431.             }
  432.         }
  433.         return $this;
  434.     }
  435.     public function getEstado(): ?string
  436.     {
  437.         return $this->estado;
  438.     }
  439.     public function setEstado(string $estado): self
  440.     {
  441.         $this->estado $estado;
  442.         return $this;
  443.     }
  444.     public function getDomicilios(): ?Domicilios
  445.     {
  446.         return $this->domicilios;
  447.     }
  448.     public function setDomicilios(Domicilios $domicilios): self
  449.     {
  450.         // set the owning side of the relation if necessary
  451.         if ($domicilios->getEcommerceCabecera() !== $this) {
  452.             $domicilios->setEcommerceCabecera($this);
  453.         }
  454.         $this->domicilios $domicilios;
  455.         return $this;
  456.     }
  457.     public function __toString(): string
  458.     {
  459.         return '(#' $this->getid() . ') ' $this->getDireccioncliente() . ' - ' $this->getNombrecliente();
  460.     }
  461.     public function isIsFinalizada(): ?bool
  462.     {
  463.         return $this->isFinalizada;
  464.     }
  465.     public function isIsEnviado(): ?bool
  466.     {
  467.         return $this->is_enviado;
  468.     }
  469.     public function addDomicilio(Domicilios $domicilio): static
  470.     {
  471.         if (!$this->domicilios->contains($domicilio)) {
  472.             $this->domicilios->add($domicilio);
  473.             $domicilio->setEcommerceCabecera($this);
  474.         }
  475.         return $this;
  476.     }
  477.     public function removeDomicilio(Domicilios $domicilio): static
  478.     {
  479.         if ($this->domicilios->removeElement($domicilio)) {
  480.             // set the owning side to null (unless already changed)
  481.             if ($domicilio->getEcommerceCabecera() === $this) {
  482.                 $domicilio->setEcommerceCabecera(null);
  483.             }
  484.         }
  485.         return $this;
  486.     }
  487. }