1
0
mirror of synced 2025-01-18 22:41:43 +03:00
This commit is contained in:
zYne 2007-05-28 15:13:11 +00:00
parent fed8eac782
commit b774c98777
2 changed files with 21 additions and 1 deletions

View File

@ -640,7 +640,7 @@ class Doctrine_Hydrate implements Serializable
if ($this->_cache) {
$dql = $this->getDql();
// calculate hash for dql query
$hash = strlen($dql) . md5($dql);
$hash = strlen($dql) . md5($dql . var_export($params, true));
$cached = $this->_cache->fetch($hash);

View File

@ -70,5 +70,25 @@ class Doctrine_Query_Cache_TestCase extends Doctrine_UnitTestCase
$this->assertTrue($coll instanceof Doctrine_Collection);
$this->assertEqual($coll->count(), 8);
}
public function testResultSetCacheSupportsPreparedStatements()
{
$q = new Doctrine_Query();
$cache = new Doctrine_Cache_Array();
$q->setCache($cache);
$q->select('u.name')->from('User u')->leftJoin('u.Phonenumber p')
->where('u.id = ?');
$coll = $q->execute(array(5));
$this->assertEqual($cache->count(), 1);
$this->assertTrue($coll instanceof Doctrine_Collection);
$this->assertEqual($coll->count(), 1);
$coll = $q->execute(array(5));
$this->assertEqual($cache->count(), 1);
$this->assertTrue($coll instanceof Doctrine_Collection);
$this->assertEqual($coll->count(), 1);
}
}