public function batch($type, $ids)
{
if (!$ids) {
return array();
}
$collection = array();
try {
$rows = $this->writer->queryRecord($type, array('id' => $ids));
} catch (SQLException $e) {
$this->handleException($e);
$rows = FALSE;
}
$this->stash[$this->nesting] = array();
if (!$rows) {
return array();
}
foreach ($rows as $row) {
$this->stash[$this->nesting][$row['id']] = $row;
}
foreach ($ids as $id) {
$collection[$id] = $this->load($type, $id);
}
$this->stash[$this->nesting] = NULL;
return $collection;
}