src/Entity/DetalleCompra.php line 19

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Enum\TipoOperacionEnum;
  4. use DateTime;
  5. use DateTimeInterface;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. /**
  9. * @ORM\Entity(repositoryClass="App\Repository\DetalleCompraRepository")
  10. * @ORM\Table(name="detalle_compra", schema="perseo")
  11. * @ORM\EntityListeners({
  12. * "App\EntityListener\DetalleCompra\ControlRelojesOperacionListener",
  13. * "App\EntityListener\DetalleCompra\CrearAccionEstadoGestionCanceladaListener"
  14. * })
  15. */
  16. class DetalleCompra extends DetalleOperacion
  17. {
  18. /**
  19. * @ORM\Column(type="float", nullable=true, name="precio_pagar", options={"default":"0.0"})
  20. */
  21. protected $precioPagar;
  22. /**
  23. * @ORM\Column(
  24. * type="datetime",
  25. * nullable=true,
  26. * name="fecha_verificacion",
  27. * options={"comment":"Será la fecha del estado de recepción en promoción, que se crea automáticamente cuando está en confirmada"}
  28. * )
  29. */
  30. private $fechaVerificacion;
  31. /**
  32. * @ORM\Column(
  33. * type="datetime",
  34. * nullable=true,
  35. * name="fecha_cancelacion",
  36. * options={"comment":"Será la fecha del estado de cancelada en promoción, que se crea automáticamente cuando se cancela el reloj"}
  37. * )
  38. */
  39. private $fechaCancelacion;
  40. /**
  41. * @ORM\ManyToOne(targetEntity="App\Entity\Compra", inversedBy="detalle")
  42. * @ORM\JoinColumn(name="compra_id", referencedColumnName="id")
  43. */
  44. protected $compra;
  45. /*
  46. * @ORM\OneToOne(targetEntity=\App\Entity\Reloj::class, inversedBy="detalleCompra")
  47. * @ORM\JoinColumn(name="reloj_compra_id", referencedColumnName="id", unique=true)
  48. */
  49. /**
  50. * @ORM\JoinColumn(name="reloj_compra_id", referencedColumnName="id")
  51. * @ORM\ManyToOne(targetEntity=\App\Entity\Reloj::class, inversedBy="detalleCompra")
  52. */
  53. private $reloj;
  54. /**
  55. * @ORM\JoinColumn(name="valoracion_reloj_id", referencedColumnName="id", unique=true)
  56. * @ORM\OneToOne(targetEntity=\App\Entity\ValoracionesRelojesSinStock::class, inversedBy="detalleCompra")
  57. */
  58. private $valoracionReloj;
  59. /*public function __toString(): string
  60. {
  61. return $this->getCompra()->__toString() . ' - ' . $this->getRelojMarca() . ' - ' . $this->getRelojModelo1() . ' - ' . $this->getRelojRef1() ?? '---';
  62. }*/
  63. public function __clone(): void
  64. {
  65. $this->setCompra(null);
  66. $this->setActividad(null);
  67. $this->setFechaVerificacion(null);
  68. $this->setCreatedAt(new DateTime());
  69. $this->setUpdatedAt(new DateTime());
  70. }
  71. public function getCompra(): ?Compra
  72. {
  73. return $this->compra;
  74. }
  75. public function setCompra(?Compra $compra): self
  76. {
  77. $this->compra = $compra;
  78. return $this;
  79. }
  80. public function getFechaVerificacion(): ?DateTimeInterface
  81. {
  82. return $this->fechaVerificacion;
  83. }
  84. public function setFechaVerificacion(?DateTimeInterface $fechaVerificacion): static
  85. {
  86. $this->fechaVerificacion = $fechaVerificacion;
  87. return $this;
  88. }
  89. public function getFechaCancelacion(): ?\DateTimeInterface
  90. {
  91. return $this->fechaCancelacion;
  92. }
  93. public function setFechaCancelacion(?\DateTimeInterface $fechaCancelacion): static
  94. {
  95. $this->fechaCancelacion = $fechaCancelacion;
  96. return $this;
  97. }
  98. public function getReloj(): ?Reloj
  99. {
  100. return $this->reloj;
  101. }
  102. public function setReloj(?Reloj $reloj): static
  103. {
  104. $this->reloj = $reloj;
  105. return $this;
  106. }
  107. public function getPrecioPagar(): ?float
  108. {
  109. return $this->precioPagar;
  110. }
  111. public function setPrecioPagar(?float $precioPagar): static
  112. {
  113. $this->precioPagar = $precioPagar;
  114. return $this;
  115. }
  116. public function getValoracionReloj(): ?ValoracionesRelojesSinStock
  117. {
  118. return $this->valoracionReloj;
  119. }
  120. public function setValoracionReloj(?ValoracionesRelojesSinStock $valoracionReloj): static
  121. {
  122. $this->valoracionReloj = $valoracionReloj;
  123. return $this;
  124. }
  125. }