src/Entity/Valoracion.php line 31

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