Commit 3b8929e8 authored by Petr Skoda's avatar Petr Skoda
Browse files

Merge branch 'MDL-25713_m2_recordset'

parents f140ee3d c3b1c4f0
......@@ -184,20 +184,22 @@ abstract class grade_object {
}
global $DB;
if ($datas = $DB->get_records_select($table, $wheresql, $newparams)) {
$result = array();
foreach($datas as $data) {
$instance = new $classname();
grade_object::set_properties($instance, $data);
$result[$instance->id] = $instance;
}
return $result;
} else {
$rs = $DB->get_recordset_select($table, $wheresql, $newparams);
//returning false rather than empty array if nothing found
if (!$rs->valid()) {
$rs->close();
return false;
}
$result = array();
foreach($rs as $data) {
$instance = new $classname();
grade_object::set_properties($instance, $data);
$result[$instance->id] = $instance;
}
$rs->close();
return $result;
}
/**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment