Commit 6ed2e63d authored by romanb's avatar romanb

added hydration mode HYDRATE_NONE

parent 1ac6d509
...@@ -360,6 +360,11 @@ final class Doctrine ...@@ -360,6 +360,11 @@ final class Doctrine
*/ */
const HYDRATE_ARRAY = 3; const HYDRATE_ARRAY = 3;
/**
* HYDRATE_NONE
*/
const HYDRATE_NONE = 4;
/** /**
* VALIDATION CONSTANTS * VALIDATION CONSTANTS
*/ */
......
...@@ -1024,6 +1024,9 @@ class Doctrine_Hydrate extends Doctrine_Locator_Injectable implements Serializab ...@@ -1024,6 +1024,9 @@ class Doctrine_Hydrate extends Doctrine_Locator_Injectable implements Serializab
*/ */
public function parseData2($stmt, $hydrationMode) public function parseData2($stmt, $hydrationMode)
{ {
if ($hydrationMode == Doctrine::HYDRATE_NONE) {
return $stmt->fetchAll(PDO::FETCH_NUM);
}
$cache = array(); $cache = array();
$rootMap = reset($this->_aliasMap); $rootMap = reset($this->_aliasMap);
......
...@@ -160,4 +160,17 @@ class Doctrine_Hydrate_FetchMode_TestCase extends Doctrine_UnitTestCase ...@@ -160,4 +160,17 @@ class Doctrine_Hydrate_FetchMode_TestCase extends Doctrine_UnitTestCase
$users = $q->execute(array($u->id), Doctrine::HYDRATE_ARRAY); $users = $q->execute(array($u->id), Doctrine::HYDRATE_ARRAY);
$this->assertEqual($users[0]['created'], null); $this->assertEqual($users[0]['created'], null);
} }
public function testHydrateNone()
{
$u = new User();
$u->name = "fetch_array_test";
$u->created = null;
$u->save();
$q = new Doctrine_Query();
$q->select('COUNT(u.id) num')->from('User u')->where('u.id = ?');
$res = $q->execute(array($u->id), Doctrine::HYDRATE_NONE);
$this->assertEqual(1, $res[0][0]);
}
} }
...@@ -240,6 +240,7 @@ class Doctrine_Record_TestCase extends Doctrine_UnitTestCase ...@@ -240,6 +240,7 @@ class Doctrine_Record_TestCase extends Doctrine_UnitTestCase
$this->connection->clear(); $this->connection->clear();
$user = $this->connection->getTable('User')->find(5); $user = $this->connection->getTable('User')->find(5);
$this->assertEqual($user->name, null); $this->assertEqual($user->name, null);
} }
......
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