1
0
mirror of synced 2025-01-31 12:32:59 +03:00

DDC-2937 More informative response when using single scalar hydrator when it returns single row but multiple columns.

This commit is contained in:
Guilherme Blanco 2014-04-16 05:44:54 +00:00
parent 6e9b15a48f
commit 1488a509b2

View File

@ -43,9 +43,13 @@ class SingleScalarHydrator extends AbstractHydrator
throw new NoResultException();
}
if ($numRows > 1 || count($data[key($data)]) > 1) {
if ($numRows > 1) {
throw new NonUniqueResultException('The query returned multiple rows. Change the query or use a different result function like getScalarResult().');
}
if (count($data[key($data)]) > 1) {
throw new NonUniqueResultException('The row contains multiple columns. Change the query or use a different result function like getScalarResult().');
}
$cache = array();
$result = $this->gatherScalarRowData($data[key($data)], $cache);