RepositoryQuery: Fix handling of queries returning no results in fetchColumn()

refs #8826
This commit is contained in:
Johannes Meyer 2015-05-21 15:02:56 +02:00
parent 4833ff109c
commit fac2ebce80
1 changed files with 3 additions and 3 deletions

View File

@ -379,7 +379,7 @@ class RepositoryQuery implements QueryInterface, Iterator
/** /**
* Fetch and return the first column of this query's first row * Fetch and return the first column of this query's first row
* *
* @return mixed * @return mixed|false False in case of no result
*/ */
public function fetchOne() public function fetchOne()
{ {
@ -400,7 +400,7 @@ class RepositoryQuery implements QueryInterface, Iterator
/** /**
* Fetch and return the first row of this query's result * Fetch and return the first row of this query's result
* *
* @return object * @return object|false False in case of no result
*/ */
public function fetchRow() public function fetchRow()
{ {
@ -434,7 +434,7 @@ class RepositoryQuery implements QueryInterface, Iterator
} }
$results = $this->query->fetchColumn(); $results = $this->query->fetchColumn();
if ($results !== false && $this->repository->providesValueConversion()) { if (! empty($results) && $this->repository->providesValueConversion()) {
$columns = $this->getColumns(); $columns = $this->getColumns();
$aliases = array_keys($columns); $aliases = array_keys($columns);
$column = is_int($aliases[0]) ? $columns[0] : $aliases[0]; $column = is_int($aliases[0]) ? $columns[0] : $aliases[0];