1
0
mirror of synced 2025-02-02 21:41:45 +03:00

Pass the connection parameters for cache key generation

That argument was added to not have key collisions for different
connections.

More info: https://github.com/doctrine/dbal/pull/713
This commit is contained in:
Luís Cobucci 2017-05-10 17:41:10 +02:00
parent 7bb02d0dbd
commit 885c431bd9
No known key found for this signature in database
GPG Key ID: EC61C5F01750ED3C

View File

@ -19,6 +19,7 @@
namespace Doctrine\ORM;
use Doctrine\DBAL\Driver\Connection;
use Doctrine\DBAL\LockMode;
use Doctrine\ORM\Query\Exec\AbstractSqlExecutor;
use Doctrine\ORM\Query\Parser;
@ -323,13 +324,22 @@ final class Query extends AbstractQuery
list($sqlParams, $types) = $this->processParameterMappings($paramMappings);
$this->evictResultSetCache($executor, $sqlParams, $types);
$this->evictResultSetCache(
$executor,
$sqlParams,
$types,
$this->_em->getConnection()->getParams()
);
return $executor->execute($this->_em->getConnection(), $sqlParams, $types);
}
private function evictResultSetCache(AbstractSqlExecutor $executor, array $sqlParams, array $types)
{
private function evictResultSetCache(
AbstractSqlExecutor $executor,
array $sqlParams,
array $types,
array $connectionParams
) {
if (null === $this->_queryCacheProfile || ! $this->getExpireResultCache()) {
return;
}
@ -338,7 +348,7 @@ final class Query extends AbstractQuery
$statements = (array) $executor->getSqlStatements(); // Type casted since it can either be a string or an array
foreach ($statements as $statement) {
$cacheKeys = $this->_queryCacheProfile->generateCacheKeys($statement, $sqlParams, $types);
$cacheKeys = $this->_queryCacheProfile->generateCacheKeys($statement, $sqlParams, $types, $connectionParams);
$cacheDriver->delete(reset($cacheKeys));
}