From 98d47a0f0f0f26d645a642304430e325abfdb98f Mon Sep 17 00:00:00 2001 From: amazuecos Date: Sun, 6 Apr 2025 06:01:12 +0200 Subject: [PATCH] remove pedido_espera_by cast --- ci4/app/Entities/Produccion/OrdenTrabajoEntity.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/ci4/app/Entities/Produccion/OrdenTrabajoEntity.php b/ci4/app/Entities/Produccion/OrdenTrabajoEntity.php index e5507b3c..2ad1b2fc 100644 --- a/ci4/app/Entities/Produccion/OrdenTrabajoEntity.php +++ b/ci4/app/Entities/Produccion/OrdenTrabajoEntity.php @@ -63,7 +63,6 @@ class OrdenTrabajoEntity extends Entity "enviar_impresion" => "bool", "portada_path" => "string", "is_pedido_espera" => "bool", - "pedido_espera_by" => "?integer" ]; @@ -124,9 +123,17 @@ class OrdenTrabajoEntity extends Entity $m = model(OrdenTrabajoFileModel::class); return $m->where('orden_trabajo_id',$this->attributes['id'])->findAll() ?? []; } - public function pedidoEsperaBy() : UsersEntity + public function pedidoEsperaBy() : ?UsersEntity { $m = model(UserModel::class); - return $m->findById($this->attributes['pedido_espera_by']); + if($this->attributes['pedido_espera_by']){ + return $m->findById($this->attributes['pedido_espera_by']); + }else{ + return null; + } + } + public function getPedidoEsperaBy(): ?UsersEntity + { + return $this->pedidoEsperaBy(); } }