Commit a478dfa4 authored by romanb's avatar romanb

removed hydration constants from doctrine_hydrate

parent d9a5bbd6
...@@ -58,14 +58,6 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable ...@@ -58,14 +58,6 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable
* constant for CREATE queries * constant for CREATE queries
*/ */
const CREATE = 4; const CREATE = 4;
/**
* Constant for the array hydration mode.
*/
const HYDRATE_ARRAY = 3;
/**
* Constant for the record (object) hydration mode.
*/
const HYDRATE_RECORD = 2;
/** /**
* @var array $params query input parameters * @var array $params query input parameters
...@@ -149,7 +141,7 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable ...@@ -149,7 +141,7 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable
/** /**
* The current hydration mode. * The current hydration mode.
*/ */
protected $_hydrationMode = self::HYDRATE_RECORD; protected $_hydrationMode = Doctrine::HYDRATE_RECORD;
/** /**
* @var boolean $_expireCache a boolean value that indicates whether or not to force cache expiration * @var boolean $_expireCache a boolean value that indicates whether or not to force cache expiration
*/ */
...@@ -296,7 +288,7 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable ...@@ -296,7 +288,7 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable
/** /**
* Sets the fetchmode. * Sets the fetchmode.
* *
* @param integer $fetchmode One of the Doctrine_Hydrate::HYDRATE_* constants. * @param integer $fetchmode One of the Doctrine::HYDRATE_* constants.
*/ */
public function setHydrationMode($hydrationMode) public function setHydrationMode($hydrationMode)
{ {
...@@ -800,7 +792,7 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable ...@@ -800,7 +792,7 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable
if ($cached === null) { if ($cached === null) {
// cache miss // cache miss
$stmt = $this->_execute($params); $stmt = $this->_execute($params);
$array = $this->parseData2($stmt, self::HYDRATE_ARRAY); $array = $this->parseData2($stmt, Doctrine::HYDRATE_ARRAY);
$cached = $this->getCachedForm($array); $cached = $this->getCachedForm($array);
...@@ -923,7 +915,7 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable ...@@ -923,7 +915,7 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable
* @return array * @return array
*/ */
public function fetchArray($params = array()) { public function fetchArray($params = array()) {
return $this->execute($params, self::HYDRATE_ARRAY); return $this->execute($params, Doctrine::HYDRATE_ARRAY);
} }
/** /**
* fetchOne * fetchOne
...@@ -943,11 +935,11 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable ...@@ -943,11 +935,11 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable
$collection = $this->execute($params, $hydrationMode); $collection = $this->execute($params, $hydrationMode);
switch ($hydrationMode) { switch ($hydrationMode) {
case self::HYDRATE_RECORD: case Doctrine::HYDRATE_RECORD:
if (count($collection) > 0) { if (count($collection) > 0) {
return $collection->getFirst(); return $collection->getFirst();
} }
case self::HYDRATE_ARRAY: case Doctrine::HYDRATE_ARRAY:
return array_shift($collection); return array_shift($collection);
} }
...@@ -978,7 +970,7 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable ...@@ -978,7 +970,7 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable
$hydrationMode = $this->_hydrationMode; $hydrationMode = $this->_hydrationMode;
} }
if ($hydrationMode === self::HYDRATE_ARRAY) { if ($hydrationMode === Doctrine::HYDRATE_ARRAY) {
$driver = new Doctrine_Hydrate_Array(); $driver = new Doctrine_Hydrate_Array();
} else { } else {
$driver = new Doctrine_Hydrate_Record(); $driver = new Doctrine_Hydrate_Record();
......
...@@ -157,7 +157,7 @@ class Doctrine_Hydrate_FetchMode_TestCase extends Doctrine_UnitTestCase ...@@ -157,7 +157,7 @@ class Doctrine_Hydrate_FetchMode_TestCase extends Doctrine_UnitTestCase
$q = new Doctrine_Query(); $q = new Doctrine_Query();
$q->select('u.*')->from('User u')->where('u.id = ?'); $q->select('u.*')->from('User u')->where('u.id = ?');
$users = $q->execute(array($u->id), Doctrine_Hydrate::HYDRATE_ARRAY); $users = $q->execute(array($u->id), Doctrine::HYDRATE_ARRAY);
$this->assertEqual($users[0]['created'], null); $this->assertEqual($users[0]['created'], 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