From 0f2c117f3ed2e2af03c50d6e1ce7ae65aaf4c41d Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Thu, 15 Jan 2015 21:17:49 +0100 Subject: [PATCH] Cloning and configuring the cache adapter for each newly created cache region (fixes cache namespacing) --- lib/Doctrine/ORM/Cache/DefaultCacheFactory.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/Doctrine/ORM/Cache/DefaultCacheFactory.php b/lib/Doctrine/ORM/Cache/DefaultCacheFactory.php index 207c34a61..6e93c6ecf 100644 --- a/lib/Doctrine/ORM/Cache/DefaultCacheFactory.php +++ b/lib/Doctrine/ORM/Cache/DefaultCacheFactory.php @@ -198,7 +198,11 @@ class DefaultCacheFactory implements CacheFactory return $this->regions[$cache['region']]; } - $region = new DefaultRegion($cache['region'], clone $this->cache, $this->regionsConfig->getLifetime($cache['region'])); + $cacheAdapter = clone $this->cache; + + $cacheAdapter->setNamespace($cache['region']); + + $region = new DefaultRegion($cache['region'], $cacheAdapter, $this->regionsConfig->getLifetime($cache['region'])); if ($cache['usage'] === ClassMetadata::CACHE_USAGE_READ_WRITE) {