function save(ePerson &$ePerson) { try { if (empty($ePerson->id)) { $ePerson->id = $this->genId(); $this->insert($ePerson->toData()); Helper_App_Log::write($this->lastQuery(), FALSE, Helper_App_Log::LOG_INSERT); } else { $this->update($ePerson->toData(FALSE), $ePerson->id); Helper_App_Log::write($this->lastQuery(), FALSE, Helper_App_Log::LOG_UPDATE); } } catch (Exception $e) { throw new Exception($e->getMessage()); } }
function filter(filterUser $filter, &$eUsers, &$ePersons, &$count) { $eUsers = array(); $ePersons = array(); $count = 0; $queryR = $this->db->query($this->filterQuery($filter)); if ($queryR === FALSE) { Helper_Log::write($this->messageError(__FUNCTION__, FALSE), Helper_Log::LOG_DB); throw new Exception("Problema ejecución en Base de Datos, ver log de errores. Consulte con Sistemas"); } $queryC = $this->db->query($this->filterQuery($filter, TRUE)); if ($queryC === FALSE) { Helper_Log::write($this->messageError(__FUNCTION__, FALSE), Helper_Log::LOG_DB); throw new Exception("Problema ejecución en Base de Datos, ver log de errores. Consulte con Sistemas"); } $row = $queryC->row_array(); $count = $row['count']; $rows = $queryR->result_array(); if (!empty($rows)) { foreach ($rows as $row) { $eUser = new eUser(); $eUser->parseRow($row, 'u_'); $eUsers[] = $eUser; $ePerson = new ePerson(); $ePerson->parseRow($row, 'p_'); $ePersons[] = $ePerson; } } }