1
0
mirror of synced 2025-01-18 22:41:43 +03:00

Fixed strange test case with CmsUser and second-level cache

This commit is contained in:
Asmir Mustafic 2015-01-17 11:52:39 +01:00 committed by Marco Pivetta
parent 5ec2014051
commit 1b4eee6d0d
2 changed files with 10 additions and 6 deletions

View File

@ -184,15 +184,15 @@ class DefaultCacheFactory implements CacheFactory
if ($mapping['cache']) {
$targetPersister = $em->getUnitOfWork()->getEntityPersister($mapping['targetEntity']);
if ($targetPersister instanceof CachedPersister) {
if (! ($targetPersister instanceof CachedPersister)) {
throw CacheException::nonCacheableEntity($mapping['targetEntity']);
}
$targetRegion = $targetPersister->getCacheRegion();
if ($targetRegion instanceof MultiGetRegion) {
return new MultiGetCollectionHydrator($em, $targetRegion);
}
}
}
return new DefaultCollectionHydrator($em);
}

View File

@ -39,6 +39,10 @@ class ExtraLazyCollectionTest extends \Doctrine\Tests\OrmFunctionalTestCase
$class->associationMappings['phonenumbers']['fetch'] = ClassMetadataInfo::FETCH_EXTRA_LAZY;
$class->associationMappings['phonenumbers']['indexBy'] = 'phonenumber';
unset($class->associationMappings['phonenumbers']['cache']);
unset($class->associationMappings['articles']['cache']);
unset($class->associationMappings['users']['cache']);
$class = $this->_em->getClassMetadata('Doctrine\Tests\Models\CMS\CmsGroup');
$class->associationMappings['users']['fetch'] = ClassMetadataInfo::FETCH_EXTRA_LAZY;
$class->associationMappings['users']['indexBy'] = 'username';