From cb780e8bb6dc48e7c2a2a82cfbde902bbf621fa2 Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Sun, 25 Jan 2015 04:45:45 +0100 Subject: [PATCH] #1169 DDC-3343 - factoring logging into cached collection persister changes --- .../AbstractCollectionPersister.php | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/lib/Doctrine/ORM/Cache/Persister/Collection/AbstractCollectionPersister.php b/lib/Doctrine/ORM/Cache/Persister/Collection/AbstractCollectionPersister.php index 7c21535cd..3172fe999 100644 --- a/lib/Doctrine/ORM/Cache/Persister/Collection/AbstractCollectionPersister.php +++ b/lib/Doctrine/ORM/Cache/Persister/Collection/AbstractCollectionPersister.php @@ -271,11 +271,17 @@ abstract class AbstractCollectionPersister implements CachedCollectionPersister */ protected function evictCollectionCache(PersistentCollection $collection) { - $this->region->evict(new CollectionCacheKey( + $key = new CollectionCacheKey( $this->sourceEntity->rootEntityName, $this->association['fieldName'], $this->uow->getEntityIdentifier($collection->getOwner()) - )); + ); + + $this->region->evict($key); + + if ($this->cacheLogger) { + $this->cacheLogger->collectionCachePut($this->regionName, $key); + } } /** @@ -286,10 +292,13 @@ abstract class AbstractCollectionPersister implements CachedCollectionPersister { /* @var $targetPersister CachedEntityPersister */ $targetPersister = $this->uow->getEntityPersister($targetEntity); + $targetRegion = $targetPersister->getCacheRegion(); + $key = new EntityCacheKey($targetEntity, $this->uow->getEntityIdentifier($element)); - $targetPersister->getCacheRegion()->evict(new EntityCacheKey( - $targetEntity, - $this->uow->getEntityIdentifier($element) - )); + $targetRegion->evict($key); + + if ($this->cacheLogger) { + $this->cacheLogger->entityCachePut($targetRegion->getName(), $key); + } } }