<?php
namespace App\Entity;
use App\Enum\TipoOperacionEnum;
use DateTime;
use DateTimeInterface;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="App\Repository\DetalleCompraRepository")
* @ORM\Table(name="detalle_compra", schema="perseo")
* @ORM\EntityListeners({
* "App\EntityListener\DetalleCompra\ControlRelojesOperacionListener",
* "App\EntityListener\DetalleCompra\CrearAccionEstadoGestionCanceladaListener"
* })
*/
class DetalleCompra extends DetalleOperacion
{
/**
* @ORM\Column(type="float", nullable=true, name="precio_pagar", options={"default":"0.0"})
*/
protected $precioPagar;
/**
* @ORM\Column(
* type="datetime",
* nullable=true,
* name="fecha_verificacion",
* options={"comment":"Será la fecha del estado de recepción en promoción, que se crea automáticamente cuando está en confirmada"}
* )
*/
private $fechaVerificacion;
/**
* @ORM\Column(
* type="datetime",
* nullable=true,
* name="fecha_cancelacion",
* options={"comment":"Será la fecha del estado de cancelada en promoción, que se crea automáticamente cuando se cancela el reloj"}
* )
*/
private $fechaCancelacion;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Compra", inversedBy="detalle")
* @ORM\JoinColumn(name="compra_id", referencedColumnName="id")
*/
protected $compra;
/*
* @ORM\OneToOne(targetEntity=\App\Entity\Reloj::class, inversedBy="detalleCompra")
* @ORM\JoinColumn(name="reloj_compra_id", referencedColumnName="id", unique=true)
*/
/**
* @ORM\JoinColumn(name="reloj_compra_id", referencedColumnName="id")
* @ORM\ManyToOne(targetEntity=\App\Entity\Reloj::class, inversedBy="detalleCompra")
*/
private $reloj;
/**
* @ORM\JoinColumn(name="valoracion_reloj_id", referencedColumnName="id", unique=true)
* @ORM\OneToOne(targetEntity=\App\Entity\ValoracionesRelojesSinStock::class, inversedBy="detalleCompra")
*/
private $valoracionReloj;
/*public function __toString(): string
{
return $this->getCompra()->__toString() . ' - ' . $this->getRelojMarca() . ' - ' . $this->getRelojModelo1() . ' - ' . $this->getRelojRef1() ?? '---';
}*/
public function __clone(): void
{
$this->setCompra(null);
$this->setActividad(null);
$this->setFechaVerificacion(null);
$this->setCreatedAt(new DateTime());
$this->setUpdatedAt(new DateTime());
}
public function getCompra(): ?Compra
{
return $this->compra;
}
public function setCompra(?Compra $compra): self
{
$this->compra = $compra;
return $this;
}
public function getFechaVerificacion(): ?DateTimeInterface
{
return $this->fechaVerificacion;
}
public function setFechaVerificacion(?DateTimeInterface $fechaVerificacion): static
{
$this->fechaVerificacion = $fechaVerificacion;
return $this;
}
public function getFechaCancelacion(): ?\DateTimeInterface
{
return $this->fechaCancelacion;
}
public function setFechaCancelacion(?\DateTimeInterface $fechaCancelacion): static
{
$this->fechaCancelacion = $fechaCancelacion;
return $this;
}
public function getReloj(): ?Reloj
{
return $this->reloj;
}
public function setReloj(?Reloj $reloj): static
{
$this->reloj = $reloj;
return $this;
}
public function getPrecioPagar(): ?float
{
return $this->precioPagar;
}
public function setPrecioPagar(?float $precioPagar): static
{
$this->precioPagar = $precioPagar;
return $this;
}
public function getValoracionReloj(): ?ValoracionesRelojesSinStock
{
return $this->valoracionReloj;
}
public function setValoracionReloj(?ValoracionesRelojesSinStock $valoracionReloj): static
{
$this->valoracionReloj = $valoracionReloj;
return $this;
}
}