Skip to content

Commit

Permalink
Fixed strange test case with CmsUser and second-level cache
Browse files Browse the repository at this point in the history
  • Loading branch information
goetas committed Jan 17, 2015
1 parent c131e32 commit e5ee538
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/Doctrine/ORM/Cache/DefaultCacheFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,13 @@ public function buildCollectionHydrator(EntityManagerInterface $em, array $mappi
if ($mapping['cache']) {
$targetPersister = $em->getUnitOfWork()->getEntityPersister($mapping['targetEntity']);

if ($targetPersister instanceof CachedPersister) {

$targetRegion = $targetPersister->getCacheRegion();
if (! ($targetPersister instanceof CachedPersister)) {
throw CacheException::nonCacheableEntity($mapping['targetEntity']);
}
$targetRegion = $targetPersister->getCacheRegion();

if ($targetRegion instanceof MultiGetRegion) {
return new MultiGetCollectionHydrator($em, $targetRegion);
}
if ($targetRegion instanceof MultiGetRegion) {
return new MultiGetCollectionHydrator($em, $targetRegion);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ public function setUp()
$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';
Expand Down

0 comments on commit e5ee538

Please sign in to comment.