mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 16:32:18 +02:00
gradebook MDL-25713 switched grade_object fetch_all_helper() over to using a recordset
This commit is contained in:
parent
88e5c58677
commit
2f9ea7d78e
@ -184,20 +184,21 @@ 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 {
|
||||
|
||||
return false;
|
||||
$rs = $DB->get_recordset_select($table, $wheresql, $newparams);
|
||||
//returning false rather than empty array if nothing found
|
||||
if (!$rs->valid()) {
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user