protected function _mapRecord($row)
{
$main = array_intersect_key($row, $this->_keyIndex);
if ($main) {
if (in_array($main, $this->_seen)) {
$message = 'Associated records hydrated out of order: ';
$message .= var_export($this->_seen, true);
throw new RuntimeException($message);
}
$this->_seen[] = $main;
}
$i = 0;
$record = array();
do {
$offset = 0;
foreach ($this->_columns as $name => $fields) {
$record[$i][$name] = array_combine($fields, array_slice($row, $offset, $count = count($fields)));
$offset += $count;
}
$i++;
if (!($peek = $this->_result->peek())) {
break;
}
if ($main !== array_intersect_key($peek, $this->_keyIndex)) {
break;
}
} while ($main && ($row = $this->_result->next()));
return $this->_hydrateRecord($this->_dependencies, $this->_model, $record, 0, $i, '');
}