[2.0] DDC-328 - Query and Result Cache Keys now depend on the hydrationMode also
This commit is contained in:
parent
8b2ca0d484
commit
5a96217d4d
@ -548,7 +548,8 @@ abstract class AbstractQuery
|
||||
} else {
|
||||
$sql = $this->getSql();
|
||||
ksort($this->_hints);
|
||||
return md5(implode(";", (array)$sql) . var_export($params, true) . var_export($this->_hints, true));
|
||||
return md5(implode(";", (array)$sql) . var_export($params, true) .
|
||||
var_export($this->_hints, true)."&hydrationMode=".$this->_hydrationMode);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -448,7 +448,8 @@ final class Query extends AbstractQuery
|
||||
|
||||
return md5(
|
||||
$this->getDql() . var_export($this->_hints, true) .
|
||||
'firstResult='.$this->_firstResult.'&maxResult='.$this->_maxResults.'DOCTRINE_QUERY_CACHE_SALT'
|
||||
'&firstResult=' . $this->_firstResult . '&maxResult=' . $this->_maxResults .
|
||||
'&hydrationMode='.$this->_hydrationMode.'DOCTRINE_QUERY_CACHE_SALT'
|
||||
);
|
||||
}
|
||||
}
|
@ -67,6 +67,19 @@ class QueryCacheTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
||||
$this->assertEquals($cacheCount + 1, count($cache->getIds()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param <type> $query
|
||||
* @depends testQueryCache_DependsOnHints
|
||||
*/
|
||||
public function testQueryCache_DependsOnHydrationMode($query)
|
||||
{
|
||||
$cache = $query->getQueryCacheDriver();
|
||||
$cacheCount = count($cache->getIds());
|
||||
|
||||
$query->getArrayResult();
|
||||
$this->assertEquals($cacheCount + 1, count($cache->getIds()));
|
||||
}
|
||||
|
||||
public function testQueryCache_NoHitSaveParserResult()
|
||||
{
|
||||
$this->_em->getConfiguration()->setQueryCacheImpl(null);
|
||||
|
@ -131,4 +131,19 @@ class ResultCacheTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
||||
|
||||
$this->assertEquals($cacheCount + 1, count($cache->getIds()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param <type> $query
|
||||
* @depends testNativeQueryResultCaching
|
||||
*/
|
||||
public function testResultCacheDependsOnHydrationMode($query)
|
||||
{
|
||||
$cache = $query->getResultCacheDriver();
|
||||
$cacheCount = count($cache->getIds());
|
||||
|
||||
$this->assertNotEquals(\Doctrine\ORM\Query::HYDRATE_ARRAY, $query->getHydrationMode());
|
||||
$query->getArrayResult();
|
||||
|
||||
$this->assertEquals($cacheCount + 1, count($cache->getIds()));
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user