Skip to content

Commit

Permalink
use global cache as fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian Brajkovic committed Mar 5, 2024
1 parent a522fbd commit c8e7c8f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 16 deletions.
9 changes: 0 additions & 9 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ public function getConfigTreeBuilder(): TreeBuilder
->defaultFalse()
->end()
->arrayNode('cache')
->setDeprecated(
'nelmio/api-doc-bundle',
'4.23',
'Using global cache config for all areas is deprecated. Define it on area level instead.'
)
->validate()
->ifTrue(function ($v) { return null !== $v['item_id'] && null === $v['pool']; })
->thenInvalid('Can not set cache.item_id if cache.pool is null')
Expand Down Expand Up @@ -129,10 +124,6 @@ public function getConfigTreeBuilder(): TreeBuilder
->prototype('variable')->end()
->end()
->arrayNode('cache')
->validate()
->ifTrue(function ($v) { return null !== $v['pool'] && null === $v['item_id']; })
->thenInvalid('Must set cache.item_id if cache.pool is set')
->end()
->children()
->scalarNode('pool')
->info('define cache pool to use')
Expand Down
9 changes: 2 additions & 7 deletions src/DependencyInjection/NelmioApiDocExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,8 @@ public function load(array $configs, ContainerBuilder $container): void
$cacheItemId = $config['cache']['item_id'] ?? null;

foreach ($config['areas'] as $area => $areaConfig) {
$areaCachePool = $cachePool;
$areaCacheItemId = $cacheItemId;

if (isset($areaConfig['cache']['pool'])) {
$areaCachePool = $areaConfig['cache']['pool'];
$areaCacheItemId = $areaConfig['cache']['item_id'];
}
$areaCachePool = $areaConfig['cache']['pool'] ?? $cachePool;
$areaCacheItemId = $areaConfig['cache']['item_id'] ?? $cacheItemId;

$nameAliases = $this->findNameAliases($config['models']['names'], $area);
$container->register(sprintf('nelmio_api_doc.generator.%s', $area), ApiDocGenerator::class)
Expand Down

0 comments on commit c8e7c8f

Please sign in to comment.