Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require orm ^2.11 and adapt cache implementation #710

Merged
merged 2 commits into from
Feb 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"doctrine/doctrine-laminas-hydrator": "^2.2.1",
"doctrine/doctrine-module": "^4.2.2",
"doctrine/event-manager": "^1.1.1",
"doctrine/orm": "^2.9.6",
"doctrine/orm": "^2.11.1",
"doctrine/persistence": "^2.2.2",
"laminas/laminas-eventmanager": "^3.4.0",
"laminas/laminas-modulemanager": "^2.11.0",
Expand Down
2 changes: 1 addition & 1 deletion src/Service/ConfigurationFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public function __invoke(ContainerInterface $serviceLocator, $requestedName, ?ar
}

// As Second Level Cache caches queries results, we reuse the result cache impl
$cacheFactory = new DefaultCacheFactory($regionsConfig, $config->getResultCacheImpl());
$cacheFactory = new DefaultCacheFactory($regionsConfig, $config->getResultCache());
$cacheFactory->setFileLockRegionDirectory($secondLevelCache->getFileLockRegionDirectory());

$cacheConfiguration = new CacheConfiguration();
Expand Down
7 changes: 5 additions & 2 deletions tests/Service/ConfigurationFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace DoctrineORMModuleTest\Service;

use Doctrine\Common\Cache\ArrayCache;
use Doctrine\Common\Cache\Psr6\CacheAdapter;
use Doctrine\ORM\Cache\CacheConfiguration;
use Doctrine\ORM\Cache\DefaultCacheFactory;
use Doctrine\ORM\Mapping\ClassMetadataFactory;
Expand Down Expand Up @@ -346,8 +347,10 @@ public function testCanInstantiateWithSecondLevelCacheConfig(): void

// Doctrine does not allow to retrieve the cache adapter from cache factory, so we are forced to use
// reflection here
$reflProperty = new ReflectionProperty($cacheFactory, 'cache');
$reflProperty = new ReflectionProperty($cacheFactory, 'cacheItemPool');
$reflProperty->setAccessible(true);
$this->assertInstanceOf(ArrayCache::class, $reflProperty->getValue($cacheFactory));
$cacheDecorator = $reflProperty->getValue($cacheFactory);
$this->assertInstanceOf(CacheAdapter::class, $cacheDecorator);
$this->assertInstanceOf(ArrayCache::class, $cacheDecorator->getCache());
}
}
1 change: 0 additions & 1 deletion tests/Service/DBALConnectionFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ public function testDoctrineAddCustomCommentedType(): void
$type = Type::getType($platform->getDoctrineTypeMapping('money'));

$this->assertInstanceOf(MoneyType::class, $type);
$this->assertTrue($platform->isCommentedDoctrineType($type));
}

public function testGettingPlatformFromContainer(): void
Expand Down