2009-01-14 00:56:43 +03:00
|
|
|
<?php
|
|
|
|
/*
|
|
|
|
* To change this template, choose Tools | Templates
|
|
|
|
* and open the template in the editor.
|
|
|
|
*/
|
|
|
|
|
2009-01-22 22:38:10 +03:00
|
|
|
namespace Doctrine\ORM\Internal\Hydration;
|
|
|
|
|
|
|
|
use \PDO;
|
|
|
|
use Doctrine\ORM\Exceptions\HydrationException;
|
|
|
|
|
2009-01-14 00:56:43 +03:00
|
|
|
/**
|
|
|
|
* Description of SingleScalarHydrator
|
|
|
|
*
|
|
|
|
* @author robo
|
|
|
|
*/
|
2009-01-22 22:38:10 +03:00
|
|
|
class SingleScalarHydrator extends AbstractHydrator
|
2009-01-14 00:56:43 +03:00
|
|
|
{
|
|
|
|
/** @override */
|
2009-01-15 16:30:44 +03:00
|
|
|
protected function _hydrateAll()
|
2009-01-14 00:56:43 +03:00
|
|
|
{
|
|
|
|
$cache = array();
|
|
|
|
$result = $this->_stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
|
|
//TODO: Let this exception be raised by Query as QueryException
|
|
|
|
if (count($result) > 1 || count($result[0]) > 1) {
|
2009-01-22 22:38:10 +03:00
|
|
|
throw HydrationException::nonUniqueResult();
|
2009-01-14 00:56:43 +03:00
|
|
|
}
|
|
|
|
$result = $this->_gatherScalarRowData($result[0], $cache);
|
|
|
|
return array_shift($result);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** {@inheritdoc} */
|
|
|
|
protected function _getRowContainer()
|
|
|
|
{
|
|
|
|
return array();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|