diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine/lib/Doctrine/ORM/Internal/Hydration/SingleScalarHydrator.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/doctrine/lib/Doctrine/ORM/Internal/Hydration/SingleScalarHydrator.php Sat Sep 24 15:40:41 2011 +0200 @@ -0,0 +1,49 @@ +. + */ + +namespace Doctrine\ORM\Internal\Hydration; + +use Doctrine\DBAL\Connection; + +/** + * Hydrator that hydrates a single scalar value from the result set. + * + * @author Roman Borschel + * @since 2.0 + */ +class SingleScalarHydrator extends AbstractHydrator +{ + /** @override */ + protected function _hydrateAll() + { + $cache = array(); + $result = $this->_stmt->fetchAll(\PDO::FETCH_ASSOC); + $num = count($result); + + if ($num == 0) { + throw new \Doctrine\ORM\NoResultException; + } else if ($num > 1 || count($result[key($result)]) > 1) { + throw new \Doctrine\ORM\NonUniqueResultException; + } + + $result = $this->_gatherScalarRowData($result[key($result)], $cache); + + return array_shift($result); + } +} \ No newline at end of file