src/Entity/Valoracion.php line 32

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Enum\EstadoValoracionEnum;
  4. use App\Validator as PerseoAssert;
  5. use DateTime;
  6. use DateTimeInterface;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. use Doctrine\Common\Collections\Collection;
  9. use Doctrine\DBAL\Types\Types;
  10. use Doctrine\ORM\Mapping as ORM;
  11. use Gedmo\Mapping\Annotation as Gedmo;
  12. use Symfony\Component\Uid\Uuid;
  13. use Symfony\Component\Validator\Constraints as Assert;
  14. /**
  15. * @ORM\Entity(repositoryClass="App\Repository\ValoracionRepository")
  16. * @ORM\Table(name="valoracion", schema="perseo",
  17. * indexes={
  18. * @ORM\Index(name="idx_valoracion_fechas_estado", columns={"fecha_enviada", "fecha_aceptacion", "fecha_rechazo", "fecha_tramitacion", "fecha_tramitada"}),
  19. * @ORM\Index(name="idx_valoracion_fecha_deleted", columns={"fecha", "deleted_at"})
  20. * }
  21. * )
  22. * @ORM\EntityListeners({
  23. * "App\EntityListener\Valoracion\CalcularIDPerseoListener"
  24. * })
  25. * @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false, hardDelete=true)
  26. * @PerseoAssert\ContraintsValidarEntidadValoracionStock()
  27. * @PerseoAssert\ContraintsValidarEntidadValoracionSinStock()
  28. */
  29. class Valoracion
  30. {
  31. static $count = 0;
  32. static $anterior = null;
  33. /**
  34. * @ORM\Id
  35. * @ORM\Column(type="uuid", unique=true)
  36. * @ORM\GeneratedValue(strategy="CUSTOM")
  37. * @ORM\CustomIdGenerator(class="doctrine.uuid_generator")
  38. */
  39. protected $id;
  40. /**
  41. * @ORM\Column(
  42. * type="string",
  43. * unique=true,
  44. * nullable=true,
  45. * name="id_perseo",
  46. * options={"comment":"Identificador perseo único generado aleatoriamente combinación letras y números"}
  47. * )
  48. */
  49. protected $IDperseo;
  50. /**
  51. * @ORM\Column(
  52. * type="boolean",
  53. * nullable=true,
  54. * name="tipo_cliente",
  55. * options={"default":0,"comment":"0 => particular, 1 => empresa"}
  56. * )
  57. */
  58. protected $tipoCliente;
  59. /**
  60. * @ORM\Column(type="datetime", nullable=true)
  61. */
  62. protected $fecha;
  63. /**
  64. * @ORM\Column(type="boolean", nullable=true, options={"default":0})
  65. */
  66. protected $exportacion;
  67. /**
  68. * @ORM\Column(type="string", length=2, nullable=true, options={"default":"es"})
  69. */
  70. protected $idioma;
  71. /**
  72. * @ORM\Column(type="text", length=255, nullable=true)
  73. */
  74. protected $comentario;
  75. /**
  76. * @ORM\Column(type="datetime", nullable=true, name="fecha_enviada")
  77. */
  78. protected $fechaEnviada;
  79. /**
  80. * @ORM\Column(type="datetime", nullable=true, name="fecha_aceptacion")
  81. */
  82. protected $fechaAceptacion;
  83. /**
  84. * @ORM\Column(type="datetime", nullable=true, name="fecha_rechazo")
  85. */
  86. protected $fechaRechazo;
  87. /**
  88. * @ORM\Column(type="datetime", nullable=true, name="fecha_tramitacion")
  89. */
  90. protected $fechaTramitacion;
  91. /**
  92. * @ORM\Column(type="datetime", nullable=true, name="fecha_tramitada")
  93. */
  94. protected $fechaTramitada;
  95. /**
  96. * @ORM\Column(
  97. * type="smallint",
  98. * length=4,
  99. * nullable=true,
  100. * options={"default":0,"unsigned":true,"comment":"Indica las veces que se ha duplicado la valoración."}
  101. * )
  102. */
  103. protected $duplicados;
  104. /**
  105. * @ORM\Column(type="float", nullable=true, precision=2, name="precio_pagar")
  106. */
  107. protected $precioPagar;
  108. /**
  109. * @ORM\Column(type="text", nullable=true, name="info_tramitacion")
  110. */
  111. protected $infoTramitacion;
  112. /**
  113. * @ORM\Column(type="text", nullable=true, name="info_valoracion")
  114. */
  115. protected $infoValoracion;
  116. /**
  117. * @ORM\Column(
  118. * type="string",
  119. * nullable=true,
  120. * name="tipo_operacion",
  121. * options={"default":"COMPRA","comment":"Gestión o Compra/Permutua"}
  122. * )
  123. */
  124. protected $tipoOperacion;
  125. /**
  126. * @ORM\Column(type="datetime", nullable=true, name="deleted_at")
  127. */
  128. protected $deletedAt;
  129. /**
  130. * @ORM\Column(type="datetime", nullable=false, name="updated_at", options={"default":"2022-01-01 00:00:00"})
  131. * @Gedmo\Timestampable(on="update")
  132. */
  133. protected $updatedAt;
  134. /**
  135. * @ORM\Column(type="datetime", nullable=false, name="created_at", options={"default":"2022-01-01 00:00:00"})
  136. * @Gedmo\Timestampable(on="create")
  137. */
  138. protected $createdAt;
  139. /**
  140. * @ORM\OneToOne(targetEntity="App\Entity\Operacion", mappedBy="valoracion")
  141. */
  142. protected $operacion;
  143. /**
  144. * @ORM\OneToMany(targetEntity="App\Entity\Valoracion", mappedBy="clone")
  145. */
  146. protected $clones;
  147. /**
  148. * @ORM\ManyToOne(targetEntity="App\Entity\Canal", inversedBy="valoraciones")
  149. * @ORM\JoinColumn(name="canal_id", referencedColumnName="id")
  150. */
  151. protected $canal;
  152. /**
  153. * @ORM\OneToMany(targetEntity="App\Entity\ValoracionesRelojes", mappedBy="valoracion", cascade={"persist"})
  154. */
  155. protected $valoracionesRelojes;
  156. /**
  157. * @ORM\OneToMany(targetEntity="App\Entity\ValoracionesRelojesStock", mappedBy="valoracion", cascade={"persist"})
  158. */
  159. protected $valoracionesRelojesStocks;
  160. // TODO cambiar cuando se activen los relojes sin stocks, crea una constraint personalizada ... controlando que exista al menos una valoración de reloj ( stock o sin stock )
  161. /**
  162. * @ORM\OneToMany(targetEntity="App\Entity\ValoracionesRelojesSinStock", mappedBy="valoracion", cascade={"persist"})
  163. * @Assert\Count(
  164. * min = 1,
  165. * minMessage = "assert.entidad.valoraciones_relojes"
  166. * )
  167. */
  168. protected $valoracionesRelojesSinStocks;
  169. /**
  170. * @ORM\OneToMany(targetEntity=\App\Entity\Reloj::class, mappedBy="valoracion")
  171. */
  172. private $relojes;
  173. /**
  174. * @ORM\ManyToOne(targetEntity="App\Entity\EstadoValoracion", inversedBy="valoraciones")
  175. * @ORM\JoinColumn(name="estado_id", referencedColumnName="id")
  176. */
  177. protected $estado;
  178. /**
  179. * @ORM\ManyToOne(targetEntity="App\Entity\UnidadNegocio", inversedBy="valoraciones")
  180. * @ORM\JoinColumn(name="unidad_negocio_id", referencedColumnName="id")
  181. */
  182. protected $unidadNegocio;
  183. /**
  184. * @ORM\ManyToOne(targetEntity="App\Entity\Usuario", inversedBy="valoraciones")
  185. * @ORM\JoinColumn(name="usuario_id", referencedColumnName="id")
  186. */
  187. protected $usuario;
  188. /**
  189. * @ORM\ManyToOne(targetEntity="App\Entity\Cliente", inversedBy="valoraciones")
  190. * @ORM\JoinColumn(name="cliente_id", referencedColumnName="id")
  191. */
  192. protected $cliente;
  193. /**
  194. * @ORM\ManyToOne(targetEntity="App\Entity\Valoracion", inversedBy="clones")
  195. * @ORM\JoinColumn(name="clone_id", referencedColumnName="id")
  196. */
  197. protected $clone;
  198. public function __construct()
  199. {
  200. $this->valoracionesRelojes = new ArrayCollection();
  201. $this->valoracionesRelojesStocks = new ArrayCollection();
  202. $this->valoracionesRelojesSinStocks = new ArrayCollection();
  203. $this->clones = new ArrayCollection();
  204. $this->relojes = new ArrayCollection();
  205. }
  206. public function __clone()
  207. {
  208. $this->setFecha(new DateTime('now'));
  209. $this->setFechaAceptacion(null);
  210. $this->setFechaEnviada(null);
  211. $this->setFechaRechazo(null);
  212. $this->setFechaTramitacion(null);
  213. $this->setFechaTramitada(null);
  214. $this->setEstado(null);
  215. $this->setCreatedAt(new DateTime('now'));
  216. $this->setUpdatedAt(new DateTime('now'));
  217. $this->setDuplicados(null);
  218. $valoracionesRelojes = $this->getValoracionesRelojes();
  219. foreach ($valoracionesRelojes??[] as $valoracion)
  220. {
  221. $valoracionClone = clone $valoracion;
  222. $valoracionClone->setClone($valoracion);
  223. $this->addValoracionesReloje($valoracionClone);
  224. }
  225. }
  226. public function __toString(): string
  227. {
  228. return $this->getIDperseo()??'---';
  229. }
  230. public function getId(): ?Uuid
  231. {
  232. return $this->id;
  233. }
  234. public function getIDperseo(): ?string
  235. {
  236. return $this->IDperseo;
  237. }
  238. public function setIDperseo(?string $IDperseo): self
  239. {
  240. $this->IDperseo = $IDperseo;
  241. return $this;
  242. }
  243. public function getTipoCliente(): ?bool
  244. {
  245. return $this->tipoCliente;
  246. }
  247. public function setTipoCliente(?bool $tipoCliente): self
  248. {
  249. $this->tipoCliente = $tipoCliente;
  250. return $this;
  251. }
  252. public function getFecha(): ?DateTimeInterface
  253. {
  254. return $this->fecha;
  255. }
  256. public function setFecha(?DateTimeInterface $fecha): self
  257. {
  258. $this->fecha = $fecha;
  259. return $this;
  260. }
  261. public function getExportacion(): ?bool
  262. {
  263. return $this->exportacion;
  264. }
  265. public function setExportacion(?bool $exportacion): self
  266. {
  267. $this->exportacion = $exportacion;
  268. return $this;
  269. }
  270. public function getIdioma(): ?string
  271. {
  272. return $this->idioma;
  273. }
  274. public function setIdioma(?string $idioma): self
  275. {
  276. $this->idioma = $idioma;
  277. return $this;
  278. }
  279. public function getComentario(): ?string
  280. {
  281. return $this->comentario;
  282. }
  283. public function setComentario(?string $comentario): self
  284. {
  285. $this->comentario = $comentario;
  286. return $this;
  287. }
  288. public function getFechaEnviada(): ?DateTimeInterface
  289. {
  290. return $this->fechaEnviada;
  291. }
  292. public function setFechaEnviada(?DateTimeInterface $fechaEnviada): self
  293. {
  294. $this->fechaEnviada = $fechaEnviada;
  295. return $this;
  296. }
  297. public function getFechaAceptacion(): ?DateTimeInterface
  298. {
  299. return $this->fechaAceptacion;
  300. }
  301. public function setFechaAceptacion(?DateTimeInterface $fechaAceptacion): self
  302. {
  303. $this->fechaAceptacion = $fechaAceptacion;
  304. return $this;
  305. }
  306. public function getFechaRechazo(): ?DateTimeInterface
  307. {
  308. return $this->fechaRechazo;
  309. }
  310. public function setFechaRechazo(?DateTimeInterface $fechaRechazo): self
  311. {
  312. $this->fechaRechazo = $fechaRechazo;
  313. return $this;
  314. }
  315. public function getFechaTramitacion(): ?DateTimeInterface
  316. {
  317. return $this->fechaTramitacion;
  318. }
  319. public function setFechaTramitacion(?DateTimeInterface $fechaTramitacion): self
  320. {
  321. $this->fechaTramitacion = $fechaTramitacion;
  322. return $this;
  323. }
  324. public function getDuplicados(): ?int
  325. {
  326. return $this->duplicados;
  327. }
  328. public function setDuplicados(?int $duplicados): self
  329. {
  330. $this->duplicados = $duplicados;
  331. return $this;
  332. }
  333. public function getDeletedAt(): ?DateTimeInterface
  334. {
  335. return $this->deletedAt;
  336. }
  337. public function setDeletedAt(?DateTimeInterface $deletedAt): self
  338. {
  339. $this->deletedAt = $deletedAt;
  340. return $this;
  341. }
  342. public function getUpdatedAt(): ?DateTimeInterface
  343. {
  344. return $this->updatedAt;
  345. }
  346. public function setUpdatedAt(DateTimeInterface $updatedAt): self
  347. {
  348. $this->updatedAt = $updatedAt;
  349. return $this;
  350. }
  351. public function getCreatedAt(): ?DateTimeInterface
  352. {
  353. return $this->createdAt;
  354. }
  355. public function setCreatedAt(DateTimeInterface $createdAt): self
  356. {
  357. $this->createdAt = $createdAt;
  358. return $this;
  359. }
  360. /**
  361. * @return Collection|ValoracionesRelojes[]
  362. */
  363. public function getValoracionesRelojes(): Collection
  364. {
  365. // $iterator = $this->valoracionesRelojes->getIterator();
  366. // $iterator->uasort(function ($a, $b) {
  367. // return ($a->getReloj()->getStock() < $b->getReloj()->getStock()) ? -1 : 1;
  368. // });
  369. //
  370. // $collection = new ArrayCollection(iterator_to_array($iterator));
  371. //
  372. // return $collection;
  373. return $this->valoracionesRelojes;
  374. }
  375. public function addValoracionesReloje(ValoracionesRelojes $valoracionesReloje): self
  376. {
  377. if (!$this->valoracionesRelojes->contains($valoracionesReloje)) {
  378. $this->valoracionesRelojes[] = $valoracionesReloje;
  379. $valoracionesReloje->setValoracion($this);
  380. }
  381. return $this;
  382. }
  383. public function removeValoracionesReloje(ValoracionesRelojes $valoracionesReloje): self
  384. {
  385. if ($this->valoracionesRelojes->removeElement($valoracionesReloje)) {
  386. // set the owning side to null (unless already changed)
  387. if ($valoracionesReloje->getValoracion() === $this) {
  388. //$valoracionesReloje->setValoracion(null);
  389. $valoracionesReloje->setDeletedAt(new DateTime('now'));
  390. }
  391. }
  392. return $this;
  393. }
  394. public function getEstado(): ?EstadoValoracion
  395. {
  396. return $this->estado;
  397. }
  398. public function setEstado(?EstadoValoracion $estado): self
  399. {
  400. $this->estado = $estado;
  401. return $this;
  402. }
  403. public function getUnidadNegocio(): ?UnidadNegocio
  404. {
  405. return $this->unidadNegocio;
  406. }
  407. public function setUnidadNegocio(?UnidadNegocio $unidadNegocio): self
  408. {
  409. $this->unidadNegocio = $unidadNegocio;
  410. return $this;
  411. }
  412. public function getUsuario(): ?Usuario
  413. {
  414. return $this->usuario;
  415. }
  416. public function setUsuario(?Usuario $usuario): self
  417. {
  418. $this->usuario = $usuario;
  419. return $this;
  420. }
  421. public function getCliente(): ?Cliente
  422. {
  423. return $this->cliente;
  424. }
  425. public function setCliente(?Cliente $cliente): self
  426. {
  427. $this->cliente = $cliente;
  428. return $this;
  429. }
  430. public function getPrecioPagar(): ?float
  431. {
  432. return $this->precioPagar;
  433. }
  434. public function setPrecioPagar(?float $precioPagar): self
  435. {
  436. $this->precioPagar = $precioPagar;
  437. return $this;
  438. }
  439. public function getInfoTramitacion(): ?string
  440. {
  441. return $this->infoTramitacion;
  442. }
  443. public function setInfoTramitacion(?string $infoTramitacion): self
  444. {
  445. $this->infoTramitacion = $infoTramitacion;
  446. return $this;
  447. }
  448. public function getInfoValoracion(): ?string
  449. {
  450. return $this->infoValoracion;
  451. }
  452. public function setInfoValoracion(?string $infoValoracion): self
  453. {
  454. $this->infoValoracion = $infoValoracion;
  455. return $this;
  456. }
  457. public function getCanal(): ?Canal
  458. {
  459. return $this->canal;
  460. }
  461. public function setCanal(?Canal $canal): self
  462. {
  463. $this->canal = $canal;
  464. return $this;
  465. }
  466. /**
  467. * @return Collection|ValoracionesRelojesStock[]
  468. */
  469. public function getValoracionesRelojesStocks(): Collection
  470. {
  471. return $this->valoracionesRelojesStocks;
  472. }
  473. public function addValoracionesRelojesStock(ValoracionesRelojesStock $valoracionesRelojesStock): self
  474. {
  475. if (!$this->valoracionesRelojesStocks->contains($valoracionesRelojesStock)) {
  476. $this->valoracionesRelojesStocks[] = $valoracionesRelojesStock;
  477. $valoracionesRelojesStock->setValoracion($this);
  478. }
  479. return $this;
  480. }
  481. public function removeValoracionesRelojesStock(ValoracionesRelojesStock $valoracionesRelojesStock): self
  482. {
  483. if ($this->valoracionesRelojesStocks->removeElement($valoracionesRelojesStock)) {
  484. // set the owning side to null (unless already changed)
  485. if ($valoracionesRelojesStock->getValoracion() === $this) {
  486. //$valoracionesRelojesStock->setValoracion(null);
  487. $valoracionesRelojesStock->setDeletedAt(new DateTime('now'));
  488. }
  489. }
  490. return $this;
  491. }
  492. /**
  493. * @return Collection|ValoracionesRelojesSinStock[]
  494. */
  495. public function getValoracionesRelojesSinStocks(): Collection
  496. {
  497. return $this->valoracionesRelojesSinStocks;
  498. }
  499. public function addValoracionesRelojesSinStock(ValoracionesRelojesSinStock $valoracionesRelojesSinStock): self
  500. {
  501. if (!$this->valoracionesRelojesSinStocks->contains($valoracionesRelojesSinStock)) {
  502. $this->valoracionesRelojesSinStocks[] = $valoracionesRelojesSinStock;
  503. $valoracionesRelojesSinStock->setValoracion($this);
  504. }
  505. return $this;
  506. }
  507. public function removeValoracionesRelojesSinStock(ValoracionesRelojesSinStock $valoracionesRelojesSinStock): self
  508. {
  509. if ($this->valoracionesRelojesSinStocks->removeElement($valoracionesRelojesSinStock)) {
  510. // set the owning side to null (unless already changed)
  511. if ($valoracionesRelojesSinStock->getValoracion() === $this) {
  512. //$valoracionesRelojesSinStock->setValoracion(null);
  513. $valoracionesRelojesSinStock->setDeletedAt(new DateTime('now'));
  514. }
  515. }
  516. return $this;
  517. }
  518. public function getExportValoracionesRelojesSinStock()
  519. {
  520. $export = [];
  521. $stocks = $this->getValoracionesRelojesSinStocks();
  522. if(self::$anterior === $this->getIDperseo()) {
  523. self::$count++;
  524. }
  525. else {
  526. self::$count = 0;
  527. self::$anterior = $this->getIDperseo();
  528. }
  529. if($stock = $stocks->get(self::$count))
  530. {
  531. $export['idperso'] = $stock->getIDperseo();
  532. $export['reloj_foto'] = $stock->getRelojFoto();
  533. $export['reloj_marca'] = $stock->getRelojMarca()?->getNombre();
  534. $export['reloj_modelo'] = $stock->getRelojModelo1();
  535. $export['reloj_referencia'] = $stock->getRelojRef1();
  536. $export['reloj_fecha'] = $stock->getRelojFecha();
  537. $export['reloj_foto'] = $stock->getRelojFoto();
  538. $export['reloj_estado'] = $stock->getRelojAspecto();
  539. $export['reloj_papeles'] = $stock->getRelojPapeles();
  540. $export['reloj_caja'] = $stock->getRelojCaja();
  541. $export['precio_referencia'] = $stock->getPrecioReferencia();
  542. $export['precio_promocion'] = $stock->getPrecioPromocion();
  543. $export['precio_min_venta'] = $stock->getPrecioMinVenta();
  544. $export['comision'] = $stock->getComision();
  545. $export['precio_coste_total'] = $stock->getPrecioCosteTotal();
  546. $export['margen_deseado'] = $stock->getMargenDeseado();
  547. $export['margen_promocion'] = $stock->getMargenPromocion();
  548. $export['margen_minimo'] = $stock->getMargenMinimo();
  549. $export['precio_pagar'] = $stock->getPrecioPagar();
  550. $export['informacion'] = $stock->getInfoValoracion();
  551. }
  552. return json_encode($export);
  553. }
  554. public function getExportValoracionesRelojesStock()
  555. {
  556. $export = [];
  557. $stocks = $this->getValoracionesRelojesStocks();
  558. if($stock = $stocks->get(self::$count))
  559. {
  560. $export['reloj'] = $stock->getReloj()?->getIDperseo();
  561. $export['es_precio_chrono24'] = $stock->getIsPrecioChrono24();
  562. $export['precio_promocion'] = $stock->getPrecioPromocion();
  563. $export['precio_coste_total'] = $stock->getPrecioCosteTotal();
  564. $export['descuento'] = $stock->getDescuento();
  565. $export['informacion'] = $stock->getInfoValoracion();
  566. }
  567. return json_encode($export);
  568. }
  569. /**
  570. * @return Collection|Valoracion[]
  571. */
  572. public function getClones(): Collection
  573. {
  574. return $this->clones;
  575. }
  576. public function addClone(Valoracion $clone): self
  577. {
  578. if (!$this->clones->contains($clone)) {
  579. $this->clones[] = $clone;
  580. $clone->setClone($this);
  581. }
  582. return $this;
  583. }
  584. public function removeClone(Valoracion $clone): self
  585. {
  586. if ($this->clones->removeElement($clone)) {
  587. // set the owning side to null (unless already changed)
  588. if ($clone->getClone() === $this) {
  589. $clone->setClone(null);
  590. }
  591. }
  592. return $this;
  593. }
  594. public function getClone(): ?self
  595. {
  596. return $this->clone;
  597. }
  598. public function setClone(?self $clone): self
  599. {
  600. $this->clone = $clone;
  601. return $this;
  602. }
  603. public function getEstadoFecha()
  604. {
  605. switch($this->getEstado()?->getKey())
  606. {
  607. case EstadoValoracionEnum::ESTADO_ESPERA:
  608. $fecha = $this->getFechaEnviada();
  609. break;
  610. case EstadoValoracionEnum::ESTADO_ACEPTADA:
  611. $fecha = $this->getFechaAceptacion();
  612. break;
  613. case EstadoValoracionEnum::ESTADO_RECHAZADA:
  614. $fecha = $this->getFechaRechazo();
  615. break;
  616. case EstadoValoracionEnum::ESTADO_EN_TRAMITACION:
  617. $fecha = $this->getFechaTramitacion();
  618. break;
  619. default:
  620. $fecha = null;
  621. break;
  622. }
  623. return $fecha;
  624. }
  625. public function getOperacion(): ?Operacion
  626. {
  627. return $this->operacion;
  628. }
  629. public function setOperacion(?Operacion $operacion): self
  630. {
  631. // unset the owning side of the relation if necessary
  632. if ($operacion === null && $this->operacion !== null) {
  633. $this->operacion->setValoracion(null);
  634. }
  635. // set the owning side of the relation if necessary
  636. if ($operacion !== null && $operacion->getValoracion() !== $this) {
  637. $operacion->setValoracion($this);
  638. }
  639. $this->operacion = $operacion;
  640. return $this;
  641. }
  642. public function isTipoCliente(): ?bool
  643. {
  644. return $this->tipoCliente;
  645. }
  646. public function isExportacion(): ?bool
  647. {
  648. return $this->exportacion;
  649. }
  650. public function getTipoOperacion(): ?string
  651. {
  652. return $this->tipoOperacion;
  653. }
  654. public function setTipoOperacion(?string $tipoOperacion): static
  655. {
  656. $this->tipoOperacion = $tipoOperacion;
  657. return $this;
  658. }
  659. public function getFechaString():?string
  660. {
  661. return $this->getFecha()?->format('d/m/Y H:i:s');
  662. }
  663. public function getFechaTramitadaString():?string
  664. {
  665. return $this->getFechaTramitada()?->format('d/m/Y H:i:s');
  666. }
  667. public function getFechaTramitacionString():?string
  668. {
  669. return $this->getFechaTramitacion()?->format('d/m/Y H:i:s');
  670. }
  671. public function getFechaAceptacionString():?string
  672. {
  673. return $this->getFechaAceptacion()?->format('d/m/Y H:i:s');
  674. }
  675. public function getFechaEnviadaString():?string
  676. {
  677. return $this->getFechaEnviada()?->format('d/m/Y H:i:s');
  678. }
  679. public function getFechaRechazoString():?string
  680. {
  681. return $this->getFechaRechazo()?->format('d/m/Y H:i:s');
  682. }
  683. public function getFechaTramitada(): ?\DateTimeInterface
  684. {
  685. return $this->fechaTramitada;
  686. }
  687. public function setFechaTramitada(?\DateTimeInterface $fechaTramitada): static
  688. {
  689. $this->fechaTramitada = $fechaTramitada;
  690. return $this;
  691. }
  692. /**
  693. * @return Collection<int, Reloj>
  694. */
  695. public function getRelojes(): Collection
  696. {
  697. return $this->relojes;
  698. }
  699. public function addReloje(Reloj $reloje): static
  700. {
  701. if (!$this->relojes->contains($reloje)) {
  702. $this->relojes->add($reloje);
  703. $reloje->setValoracion($this);
  704. }
  705. return $this;
  706. }
  707. public function removeReloje(Reloj $reloje): static
  708. {
  709. if ($this->relojes->removeElement($reloje)) {
  710. // set the owning side to null (unless already changed)
  711. if ($reloje->getValoracion() === $this) {
  712. $reloje->setValoracion(null);
  713. }
  714. }
  715. return $this;
  716. }
  717. }