This commit is contained in:
parent
fed8eac782
commit
b774c98777
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user