Commit 43e35d3b authored by romanb's avatar romanb

moved hydration stuff

parent bfff430e
This diff is collapsed.
<?php
class Doctrine_ORM_Exceptions_HydrationException extends Doctrine_ORM_Exceptions_ORMException
{
public static function nonUniqueResult()
{
return new self("The result returned by the query was not unique.");
}
}
?>
\ No newline at end of file
......@@ -19,6 +19,8 @@
* <http://www.phpdoctrine.org>.
*/
#namespace Doctrine::ORM::Internal::Hydration;
/**
* Base class for all hydrators (ok, we got only 1 currently).
*
......@@ -29,7 +31,7 @@
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Roman Borschel <roman@code-factory.org>
*/
abstract class Doctrine_Hydrator_Abstract
abstract class Doctrine_ORM_Internal_Hydration_AbstractHydrator
{
/**
* @var array $_queryComponents
......
......@@ -19,7 +19,7 @@
* <http://www.phpdoctrine.org>.
*/
#namespace Doctrine::ORM::Internal;
#namespace Doctrine::ORM::Internal::Hydration;
/**
* Defines an array hydration strategy.
......@@ -31,7 +31,7 @@
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Roman Borschel <roman@code-factory.org>
*/
class Doctrine_Hydrator_ArrayDriver
class Doctrine_ORM_Internal_Hydration_ArrayDriver
{
/**
......
......@@ -30,7 +30,7 @@
* @author Roman Borschel <roman@code-factory.org>
* @todo Rename to ObjectDriver
*/
class Doctrine_Hydrator_RecordDriver
class Doctrine_ORM_Internal_Hydration_ObjectDriver
{
/** Collections initialized by the driver */
protected $_collections = array();
......
......@@ -19,7 +19,7 @@
* <http://www.phpdoctrine.org>.
*/
#namespace Doctrine::ORM::Internal;
#namespace Doctrine::ORM::Internal::Hydration;
/**
* The hydrator has the tedious to process result sets returned by the database
......@@ -56,7 +56,7 @@
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Roman Borschel <roman@code-factory.org>
*/
class Doctrine_HydratorNew extends Doctrine_Hydrator_Abstract
class Doctrine_ORM_Internal_Hydration_StandardHydrator extends Doctrine_ORM_Internal_Hydration_AbstractHydrator
{
/**
* Parses the data returned by statement object.
......@@ -97,9 +97,9 @@ class Doctrine_HydratorNew extends Doctrine_Hydrator_Abstract
$this->_queryComponents = $parserResult->getQueryComponents();
if ($hydrationMode == Doctrine::HYDRATE_ARRAY) {
$driver = new Doctrine_Hydrator_ArrayDriver();
$driver = new Doctrine_ORM_Internal_Hydration_ArrayDriver();
} else {
$driver = new Doctrine_Hydrator_RecordDriver($this->_em);
$driver = new Doctrine_ORM_Internal_Hydration_ObjectDriver($this->_em);
}
$s = microtime(true);
......@@ -148,7 +148,7 @@ class Doctrine_HydratorNew extends Doctrine_Hydrator_Abstract
if ($hydrationMode == Doctrine::HYDRATE_SINGLE_SCALAR) {
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
if (count($result) > 1 || count($result[0]) > 1) {
throw Doctrine_Hydrator_Exception::nonUniqueResult();
throw Doctrine_ORM_Exceptions_HydrationException::nonUniqueResult();
}
return array_shift($this->_gatherScalarRowData($result[0], $cache));
}
......
......@@ -96,7 +96,7 @@ class Doctrine_Query extends Doctrine_Query_Abstract
public function __construct(Doctrine_EntityManager $entityManager)
{
$this->_entityManager = $entityManager;
$this->_hydrator = new Doctrine_Hydrator($entityManager);
$this->_hydrator = new Doctrine_ORM_Internal_Hydration_StandardHydrator($entityManager);
$this->free();
}
......
......@@ -71,7 +71,7 @@ class Orm_Hydration_BasicHydrationTest extends Doctrine_OrmTestCase
$stmt = new Doctrine_HydratorMockStatement($resultSet);
$hydrator = new Doctrine_HydratorNew($this->_em);
$hydrator = new Doctrine_ORM_Internal_Hydration_StandardHydrator($this->_em);
$result = $hydrator->hydrateResultSet($this->_createParserResult(
$stmt, $queryComponents, $tableAliasMap, $hydrationMode));
......@@ -158,7 +158,7 @@ class Orm_Hydration_BasicHydrationTest extends Doctrine_OrmTestCase
);
$stmt = new Doctrine_HydratorMockStatement($resultSet);
$hydrator = new Doctrine_HydratorNew($this->_em);
$hydrator = new Doctrine_ORM_Internal_Hydration_StandardHydrator($this->_em);
$result = $hydrator->hydrateResultSet($this->_createParserResult(
$stmt, $queryComponents, $tableAliasMap, $hydrationMode, true));
......@@ -254,7 +254,7 @@ class Orm_Hydration_BasicHydrationTest extends Doctrine_OrmTestCase
);
$stmt = new Doctrine_HydratorMockStatement($resultSet);
$hydrator = new Doctrine_HydratorNew($this->_em);
$hydrator = new Doctrine_ORM_Internal_Hydration_StandardHydrator($this->_em);
$result = $hydrator->hydrateResultSet($this->_createParserResult(
$stmt, $queryComponents, $tableAliasMap, $hydrationMode, true));
......@@ -347,7 +347,7 @@ class Orm_Hydration_BasicHydrationTest extends Doctrine_OrmTestCase
$stmt = new Doctrine_HydratorMockStatement($resultSet);
$hydrator = new Doctrine_HydratorNew($this->_em);
$hydrator = new Doctrine_ORM_Internal_Hydration_StandardHydrator($this->_em);
$result = $hydrator->hydrateResultSet($this->_createParserResult(
$stmt, $queryComponents, $tableAliasMap, $hydrationMode, true));
......@@ -487,7 +487,7 @@ class Orm_Hydration_BasicHydrationTest extends Doctrine_OrmTestCase
);
$stmt = new Doctrine_HydratorMockStatement($resultSet);
$hydrator = new Doctrine_HydratorNew($this->_em);
$hydrator = new Doctrine_ORM_Internal_Hydration_StandardHydrator($this->_em);
$result = $hydrator->hydrateResultSet($this->_createParserResult(
$stmt, $queryComponents, $tableAliasMap, $hydrationMode, true));
......@@ -662,7 +662,7 @@ class Orm_Hydration_BasicHydrationTest extends Doctrine_OrmTestCase
);
$stmt = new Doctrine_HydratorMockStatement($resultSet);
$hydrator = new Doctrine_HydratorNew($this->_em);
$hydrator = new Doctrine_ORM_Internal_Hydration_StandardHydrator($this->_em);
$result = $hydrator->hydrateResultSet($this->_createParserResult(
$stmt, $queryComponents, $tableAliasMap, $hydrationMode, true));
......@@ -827,7 +827,7 @@ class Orm_Hydration_BasicHydrationTest extends Doctrine_OrmTestCase
);
$stmt = new Doctrine_HydratorMockStatement($resultSet);
$hydrator = new Doctrine_HydratorNew($this->_em);
$hydrator = new Doctrine_ORM_Internal_Hydration_StandardHydrator($this->_em);
$result = $hydrator->hydrateResultSet($this->_createParserResult(
$stmt, $queryComponents, $tableAliasMap, $hydrationMode));
......@@ -918,7 +918,7 @@ class Orm_Hydration_BasicHydrationTest extends Doctrine_OrmTestCase
);
$stmt = new Doctrine_HydratorMockStatement($resultSet);
$hydrator = new Doctrine_HydratorNew($this->_em);
$hydrator = new Doctrine_ORM_Internal_Hydration_StandardHydrator($this->_em);
if ($name == 'result1') {
$result = $hydrator->hydrateResultSet($this->_createParserResult(
......@@ -933,7 +933,7 @@ class Orm_Hydration_BasicHydrationTest extends Doctrine_OrmTestCase
$result = $hydrator->hydrateResultSet($this->_createParserResult(
$stmt, $queryComponents, $tableAliasMap, Doctrine::HYDRATE_SINGLE_SCALAR));
$this->fail();
} catch (Doctrine_Hydrator_Exception $ex) {}
} catch (Doctrine_ORM_Exceptions_HydrationException $ex) {}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment