From 1c94c16234941903bb84d4745df0c51e43e25394 Mon Sep 17 00:00:00 2001 From: Asmir Mustafic Date: Tue, 11 Feb 2014 14:59:31 +0100 Subject: [PATCH] Can cache empty collections I should be able to cache an "empty" collection. I have a some objects, where 90% of these have on-to-many relations with zero associated elements. This causes doctrine to run a query each time, instead of cache it as empty relation. --- lib/Doctrine/ORM/Cache/Persister/AbstractEntityPersister.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Doctrine/ORM/Cache/Persister/AbstractEntityPersister.php b/lib/Doctrine/ORM/Cache/Persister/AbstractEntityPersister.php index e084405ed..eaca3d75e 100644 --- a/lib/Doctrine/ORM/Cache/Persister/AbstractEntityPersister.php +++ b/lib/Doctrine/ORM/Cache/Persister/AbstractEntityPersister.php @@ -543,7 +543,7 @@ abstract class AbstractEntityPersister implements CachedEntityPersister $list = $this->persister->loadOneToManyCollection($assoc, $sourceEntity, $coll); - if ($hasCache && ! empty($list)) { + if ($hasCache) { $persister->storeCollectionCache($key, $list); if ($this->cacheLogger) {