$committed = true;
                     $result->successMsg .= sprintf(_t('crud.idUpdated'), _t('crud.accttype.tableDescription', 'Accttype'), $row->id) . "\n";
                 }
             }
             if (!$success) {
                 if ($result->errorMsg == '' && empty($result->fieldErrors)) {
                     $result->errorMsg .= sprintf(_t('crud.rowCouldNotBeUpdated'), _t('crud.accttype.tableDescription', 'Accttype')) . "\n";
                 }
             }
         }
     }
 } else {
     // if ($row->id > 0)
     // Convert the value object into the actual entity.
     $newRow = new Accttype();
     $newRow->loadFromArray((array) $row);
     if (function_exists('preInsertHook')) {
         preInsertHook();
     }
     try {
         $success = $accttypeDAO->insert($newRow);
     } catch (Exception $ex) {
         $success = false;
     }
     if ($success) {
         $row->id = $newRow->id;
         $justInsertedRowId = $newRow->id;
         if (function_exists('postInsertHook')) {
             postInsertHook();
         }
         if ($success) {
Exemplo n.º 2
0
 public function findWithPreparedStatement($ps)
 {
     $cacheKey = null;
     if ($this->cache !== null) {
         $cacheKey = serialize($ps);
         if (($rows = $this->cache->get($cacheKey)) !== false) {
             return $rows;
         }
     }
     $rows = array();
     $rs = $this->connection->executeQuery($ps);
     while ($arr = $this->connection->fetchArray($rs)) {
         $row = new Accttype();
         $row->loadFromArray($arr);
         $rows[] = $row;
     }
     $this->connection->freeResult($rs);
     if ($this->cache !== null) {
         $this->cache->set($cacheKey, $rows);
     }
     return $rows;
 }