public function convertToBeans($type, $rows, $mask = NULL)
{
$masklen = 0;
if ($mask !== NULL) {
$masklen = mb_strlen($mask);
}
$collection = array();
$this->stash[$this->nesting] = array();
foreach ($rows as $row) {
$meta = array();
if (!is_null($mask)) {
foreach ($row as $key => $value) {
if (strpos($key, $mask) === 0) {
unset($row[$key]);
$meta[$key] = $value;
}
}
}
$id = $row['id'];
$this->stash[$this->nesting][$id] = $row;
$collection[$id] = $this->load($type, $id);
if ($mask !== NULL) {
$collection[$id]->setMeta('data.bundle', $meta);
}
}
$this->stash[$this->nesting] = NULL;
return $collection;
}