mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
45 lines
1.2 KiB
PHP
45 lines
1.2 KiB
PHP
<?php
|
|
namespace App\Entities\Pedidos;
|
|
|
|
use App\Entities\Clientes\ClienteEntity;
|
|
use App\Models\Clientes\ClienteModel;
|
|
use App\Models\Pedidos\PedidoLineaModel;
|
|
use App\Models\Presupuestos\PresupuestoModel;
|
|
use CodeIgniter\Entity;
|
|
|
|
class PedidoEntity extends \CodeIgniter\Entity\Entity
|
|
{
|
|
protected $attributes = [
|
|
"id" => null,
|
|
"total_precio" => null,
|
|
"total_tirada" => null,
|
|
"estado" => null,
|
|
"user_created_id" => null,
|
|
"user_updated_id" => null,
|
|
"user_validated_id" => null,
|
|
"fecha_entrega_real" => null,
|
|
"fecha_impresion" => null,
|
|
"fecha_encuadernado" => null,
|
|
"fecha_entrega_externo" => null,
|
|
"created_at" => null,
|
|
"updated_at" => null,
|
|
"validated_at" => null,
|
|
];
|
|
|
|
|
|
protected $casts = [
|
|
"total_precio" => "float",
|
|
"total_tirada" => "float",
|
|
];
|
|
|
|
public function cliente() : ?ClienteEntity
|
|
{
|
|
$m = model(ClienteModel::class);
|
|
$pl = model(PedidoLineaModel::class);
|
|
$pm = model(PresupuestoModel::class);
|
|
$pedido_linea = $pl->where('pedido_id',$this->attributes["id"])->first();
|
|
$pre = $pm->find($pedido_linea->presupuesto_id);
|
|
return $m->find($pre->cliente_id);
|
|
}
|
|
}
|