Skip to content

Commit

Permalink
Remove deprecated cacheProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
atomiix committed Jul 7, 2021
1 parent c74fa90 commit b958a9c
Show file tree
Hide file tree
Showing 13 changed files with 211 additions and 85 deletions.
12 changes: 12 additions & 0 deletions app/config/config_legacy_dev.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
imports:
- { resource: config_legacy.yml }

doctrine:
orm:
metadata_cache_driver:
type: pool
pool: array
query_cache_driver:
type: pool
pool: array_doctrine
result_cache_driver:
type: pool
pool: array_doctrine
5 changes: 4 additions & 1 deletion app/config/config_legacy_prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ doctrine:
pool: "%cache.driver%"
query_cache_driver:
type: pool
pool: "%cache.driver%"
pool: "%cache.driver.doctrine%"
result_cache_driver:
type: pool
pool: "%cache.driver.doctrine%"
2 changes: 1 addition & 1 deletion app/config/config_legacy_test.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
imports:
- { resource: config_legacy.yml }
- { resource: config_legacy_dev.yml }
1 change: 1 addition & 0 deletions app/config/set_parameters.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
}
}
$container->setParameter('cache.driver', $driver);
$container->setParameter('cache.driver.doctrine', $driver . '_doctrine');
$container->setParameter('cache.adapter', $adapters[$driver]);

// Parameter used only in dev and test env
Expand Down
9 changes: 9 additions & 0 deletions classes/container/LegacyCompilerPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
use PrestaShop\PrestaShop\Adapter\Configuration;
use PrestaShopBundle\DependencyInjection\CacheAdapterFactory;
use Symfony\Component\Cache\Adapter\AdapterInterface;
use Symfony\Component\Cache\DoctrineProvider;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
Expand Down Expand Up @@ -75,7 +76,15 @@ private function buildCacheDefinition(string $cacheDriver, ContainerBuilder $con
->setFactory([new Reference(CacheAdapterFactory::class), 'getCacheAdapter'])
->setArguments([$cacheDriver])
;

$doctrineDefinition = new Definition(DoctrineProvider::class);
$doctrineDefinition
->setPublic(true)
->setArguments([new Reference($cacheDriver)])
;

$container->setDefinition($cacheDriver, $definition);
$container->setDefinition($cacheDriver . '_doctrine', $doctrineDefinition);
}

private function buildSyntheticDefinitions(array $keys, ContainerBuilder $container): void
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"cssjanus/cssjanus": "dev-patch-1",
"curl/curl": "^1.2.1",
"defuse/php-encryption": "~2.0.1",
"doctrine/cache": "^1.8",
"doctrine/cache": "^2.0",
"doctrine/doctrine-bundle": "^2.3",
"doctrine/orm": "^2.7",
"egulias/email-validator": "^2.1",
Expand Down
Loading

0 comments on commit b958a9c

Please sign in to comment.