query prepareResult return one column

This commit is contained in:
evgen-d 2014-10-23 15:03:48 +04:00
parent 1f23259b58
commit acaf1780bc

View File

@ -796,6 +796,7 @@ class Query extends Component implements QueryInterface
public function prepareResult($rows) public function prepareResult($rows)
{ {
$result = []; $result = [];
if (isset($rows[0]) && $rows[0] instanceof Document) {
if ($this->indexBy === null) { if ($this->indexBy === null) {
foreach ($rows as $row) { foreach ($rows as $row) {
$result[] = $row->getAll(); $result[] = $row->getAll();
@ -810,6 +811,9 @@ class Query extends Component implements QueryInterface
$result[$key] = $row->getAll(); $result[$key] = $row->getAll();
} }
} }
} else {
$result = $rows;
}
return $result; return $result;
} }