public function createEntity() { $tipo = (new TipoCompra())->findById($_POST['txttipcom']); $user = (new Usuario())->findById($_POST['txtcli']); $veh = (new Vehiculo())->findById($_POST['txtveh']); $obj = new Compra(); $obj->setId(isset($_POST['hid']) ? $_POST['hid'] : 0); $obj->setFecha($_POST['dtfecha']); $obj->setCuotas($this->checkTypeCuota($tipo)); $obj->setCant($_POST['txtcant']); $obj->setTipo($tipo); $obj->setUser($user); $obj->setVeh($veh); return $obj; }
public function createEntity($row) { $tipo = $this->mod_tc->findById($row['tipoc']); $user = $this->mod_u->findById($row['usuario']); $veh = $this->mod_v->findById($row['veh']); $obj = new Compra(); $obj->setId($row['id']); $obj->setFecha($row['fecha']); $obj->setCuotas($row['cuotas']); $obj->setCant($row['cant']); $obj->setTipo($tipo); $obj->setUser($user); $obj->setVeh($veh); $obj->setPagos($this->find_pagos($obj->getId())); return $obj; }