Skip to content

Commit 6d04918

Browse files
committed
Merge branch '5.4' into 6.0
* 5.4: Don't rely on session service in tests [Mime] Fix encoding filenames in multipart/form-data Properly warn about deprecation of IS_AUTHENTICATED_ANONYMOUSLY [Lock] Create tables in transaction only if supported by driver [Validator] Improve French translation [HttpFoundation] Take php session.cookie settings into account [Translations] Add missing translations for Galician (gl) [ErrorHandler] fix on patching return types on Windows [DependencyInjection] fix linting callable classes alias `cache.app.taggable` to `cache.app` if using `cache.adapter.redis_tag_aware` restore the overriden locale on tearDown - avoid interfering with any configured value [Serializer] Improve UidNormalizer denormalize error message [DependencyInjection] Cast tag value to string
2 parents 3329278 + 5198f23 commit 6d04918

8 files changed

+90
-1
lines changed

DependencyInjection/FrameworkExtension.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2125,7 +2125,9 @@ private function registerCacheConfiguration(array $config, ContainerBuilder $con
21252125
$pool['reset'] = 'reset';
21262126
}
21272127

2128-
if ($isRedisTagAware) {
2128+
if ($isRedisTagAware && 'cache.app' === $name) {
2129+
$container->setAlias('cache.app.taggable', $name);
2130+
} elseif ($isRedisTagAware) {
21292131
$tagAwareId = $name;
21302132
$container->setAlias('.'.$name.'.inner', $name);
21312133
} elseif ($pool['tags']) {
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
$container->loadFromExtension('framework', [
4+
'cache' => [
5+
'app' => 'cache.adapter.redis_tag_aware',
6+
],
7+
]);
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
$container->loadFromExtension('framework', [
4+
'cache' => [
5+
'app' => 'cache.redis_tag_aware.bar',
6+
'pools' => [
7+
'cache.redis_tag_aware.foo' => [
8+
'adapter' => 'cache.adapter.redis_tag_aware',
9+
],
10+
'cache.redis_tag_aware.bar' => [
11+
'adapter' => 'cache.redis_tag_aware.foo',
12+
],
13+
],
14+
],
15+
]);
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" ?>
2+
<container xmlns="http://symfony.com/schema/dic/services"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xmlns:framework="http://symfony.com/schema/dic/symfony"
5+
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd
6+
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
7+
8+
<framework:config>
9+
<framework:cache>
10+
<framework:app>cache.adapter.redis_tag_aware</framework:app>
11+
</framework:cache>
12+
</framework:config>
13+
</container>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" ?>
2+
<container xmlns="http://symfony.com/schema/dic/services"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xmlns:framework="http://symfony.com/schema/dic/symfony"
5+
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd
6+
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
7+
8+
<framework:config>
9+
<framework:cache>
10+
<framework:app>cache.redis_tag_aware.bar</framework:app>
11+
<framework:pool name="cache.redis_tag_aware.foo" adapter="cache.adapter.redis_tag_aware" />
12+
<framework:pool name="cache.redis_tag_aware.bar" adapter="cache.redis_tag_aware.foo" />
13+
</framework:cache>
14+
</framework:config>
15+
</container>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
framework:
2+
cache:
3+
app: cache.adapter.redis_tag_aware
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
framework:
2+
cache:
3+
app: cache.redis_tag_aware.bar
4+
pools:
5+
cache.redis_tag_aware.foo:
6+
adapter: cache.adapter.redis_tag_aware
7+
cache.redis_tag_aware.bar:
8+
adapter: cache.redis_tag_aware.foo

Tests/DependencyInjection/FrameworkExtensionTest.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1588,6 +1588,32 @@ public function testRedisTagAwareAdapter()
15881588
}
15891589
}
15901590

1591+
/**
1592+
* @dataProvider testAppRedisTagAwareConfigProvider
1593+
*/
1594+
public function testAppRedisTagAwareAdapter()
1595+
{
1596+
$container = $this->createContainerFromFile('cache_app_redis_tag_aware');
1597+
1598+
foreach ([TagAwareCacheInterface::class, CacheInterface::class, CacheItemPoolInterface::class] as $alias) {
1599+
$def = $container->findDefinition($alias);
1600+
1601+
while ($def instanceof ChildDefinition) {
1602+
$def = $container->getDefinition($def->getParent());
1603+
}
1604+
1605+
$this->assertSame(RedisTagAwareAdapter::class, $def->getClass());
1606+
}
1607+
}
1608+
1609+
public function testAppRedisTagAwareConfigProvider(): array
1610+
{
1611+
return [
1612+
['cache_app_redis_tag_aware'],
1613+
['cache_app_redis_tag_aware_pool'],
1614+
];
1615+
}
1616+
15911617
public function testRemovesResourceCheckerConfigCacheFactoryArgumentOnlyIfNoDebug()
15921618
{
15931619
$container = $this->createContainer(['kernel.debug' => true]);

0 commit comments

Comments
 (0)