Skip to content

Commit

Permalink
Fix deprecation for cache.app adapter with tags
Browse files Browse the repository at this point in the history
  • Loading branch information
keulinho committed Nov 11, 2024
1 parent 9f81d93 commit c15618b
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion UPGRADE-7.2.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Cache
-----

* `igbinary_serialize()` is not used by default when the igbinary extension is installed
* Deprecate making `cache.app` adapter taggable, use the `cache.app.taggable` adapter instead
* Deprecate making `cache.app` pool taggable, use the `cache.app.taggable` pool instead

Console
-------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2396,9 +2396,9 @@ private function registerCacheConfiguration(array $config, ContainerBuilder $con
];
}
foreach ($config['pools'] as $name => $pool) {
if (\in_array('cache.app', $pool['adapters'] ?? [], true) && $pool['tags']) {
trigger_deprecation('symfony/framework-bundle', '7.2', 'Using the "tags" option with the "cache.app" adapter is deprecated. You can use the "cache.app.taggable" adapter instead (aliased to the TagAwareCacheInterface for autowiring).');
// throw new LogicException('The "tags" option cannot be used with the "cache.app" adapter. You can use the "cache.app.taggable" adapter instead (aliased to the TagAwareCacheInterface for autowiring).');
if ('cache.app' === $name && $pool['tags']) {
trigger_deprecation('symfony/framework-bundle', '7.2', 'Using the "tags" option with the "cache.app" pool is deprecated. You can use the "cache.app.taggable" pool instead (aliased to the TagAwareCacheInterface for autowiring).');
// throw new LogicException('The "tags" option cannot be used with the "cache.app" pool. You can use the "cache.app.taggable" pool instead (aliased to the TagAwareCacheInterface for autowiring).');
}

$pool['adapters'] = $pool['adapters'] ?: ['cache.app'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
'php_errors' => ['log' => true],
'cache' => [
'pools' => [
'app.tagaware' => [
'adapter' => 'cache.app',
'cache.app' => [
'tags' => true,
],
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<framework:annotations enabled="false" />
<framework:php-errors log="true" />
<framework:cache>
<framework:pool name="app.tagaware" adapter="cache.app" tags="true" />
<framework:pool name="cache.app" tags="true" />
</framework:cache>
</framework:config>
</container>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@ framework:
log: true
cache:
pools:
app.tagaware:
adapter: cache.app
cache.app:
tags: true
Original file line number Diff line number Diff line change
Expand Up @@ -1861,7 +1861,7 @@ public function testCacheTaggableTagAppliedToPools()
*/
public function testTaggableCacheAppIsDeprecated()
{
$this->expectUserDeprecationMessage('Since symfony/framework-bundle 7.2: Using the "tags" option with the "cache.app" adapter is deprecated. You can use the "cache.app.taggable" adapter instead (aliased to the TagAwareCacheInterface for autowiring).');
$this->expectUserDeprecationMessage('Since symfony/framework-bundle 7.2: Using the "tags" option with the "cache.app" pool is deprecated. You can use the "cache.app.taggable" pool instead (aliased to the TagAwareCacheInterface for autowiring).');

$this->createContainerFromFile('cache_cacheapp_tagaware');
}
Expand Down

0 comments on commit c15618b

Please sign in to comment.