From 0dde8585c32832782532135cc5e3449a831f79ce Mon Sep 17 00:00:00 2001 From: Antonio Vilar Date: Fri, 27 Jun 2014 20:17:43 +0200 Subject: [PATCH 1/2] Fixed query cache id generation: added platform to hash --- lib/Doctrine/ORM/Query.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/Doctrine/ORM/Query.php b/lib/Doctrine/ORM/Query.php index 212675e0e..c52a709db 100644 --- a/lib/Doctrine/ORM/Query.php +++ b/lib/Doctrine/ORM/Query.php @@ -682,8 +682,13 @@ final class Query extends AbstractQuery { ksort($this->_hints); + $platform = $this->getEntityManager() + ->getConnection() + ->getDatabasePlatform() + ->getName(); + return md5( - $this->getDql() . serialize($this->_hints) . + $this->getDql() . serialize($this->_hints) . $platform . ($this->_em->hasFilters() ? $this->_em->getFilters()->getHash() : '') . '&firstResult=' . $this->_firstResult . '&maxResult=' . $this->_maxResults . '&hydrationMode='.$this->_hydrationMode.'DOCTRINE_QUERY_CACHE_SALT' From 4e61ceb0df2038e92c42cc4c926d4358ed5719e2 Mon Sep 17 00:00:00 2001 From: Antonio Vilar Date: Fri, 27 Jun 2014 22:36:02 +0200 Subject: [PATCH 2/2] Added platform key --- lib/Doctrine/ORM/Query.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Doctrine/ORM/Query.php b/lib/Doctrine/ORM/Query.php index c52a709db..02a1dc9eb 100644 --- a/lib/Doctrine/ORM/Query.php +++ b/lib/Doctrine/ORM/Query.php @@ -688,7 +688,8 @@ final class Query extends AbstractQuery ->getName(); return md5( - $this->getDql() . serialize($this->_hints) . $platform . + $this->getDql() . serialize($this->_hints) . + '&platform=' . $platform . ($this->_em->hasFilters() ? $this->_em->getFilters()->getHash() : '') . '&firstResult=' . $this->_firstResult . '&maxResult=' . $this->_maxResults . '&hydrationMode='.$this->_hydrationMode.'DOCTRINE_QUERY_CACHE_SALT'