Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4ccabcd

Browse filesBrowse files
dunglasnicolas-grekas
authored andcommitted
[PropertyAccess] Add PSR-6 cache
1 parent 052c314 commit 4ccabcd
Copy full SHA for 4ccabcd

File tree

Expand file treeCollapse file tree

7 files changed

+296
-117
lines changed
Filter options
Expand file treeCollapse file tree

7 files changed

+296
-117
lines changed

‎src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection;
1313

1414
use Doctrine\Common\Annotations\Reader;
15+
use Symfony\Component\Cache\Adapter\AdapterInterface;
1516
use Symfony\Component\DependencyInjection\ContainerBuilder;
1617
use Symfony\Component\DependencyInjection\ContainerInterface;
1718
use Symfony\Component\DependencyInjection\Definition;
@@ -24,6 +25,7 @@
2425
use Symfony\Component\Finder\Finder;
2526
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
2627
use Symfony\Component\Config\FileLocator;
28+
use Symfony\Component\PropertyAccess\PropertyAccessor;
2729
use Symfony\Component\Serializer\Mapping\Factory\CacheClassMetadataFactory;
2830
use Symfony\Component\Serializer\Normalizer\DataUriNormalizer;
2931
use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
@@ -1062,6 +1064,15 @@ private function registerCacheConfiguration(array $config, ContainerBuilder $con
10621064
$container->setDefinition($name, $definition);
10631065
}
10641066

1067+
if (method_exists(PropertyAccessor::class, 'createCache')) {
1068+
$propertyAccessDefinition = $container->register('cache.property_access', AdapterInterface::class);
1069+
$propertyAccessDefinition->setPublic(false);
1070+
$propertyAccessDefinition->setFactory(array(PropertyAccessor::class, 'createCache'));
1071+
$propertyAccessDefinition->setArguments(array(null, null, $version, new Reference('logger', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)));
1072+
$propertyAccessDefinition->addTag('cache.pool', array('clearer' => 'cache.default_clearer'));
1073+
$propertyAccessDefinition->addTag('monolog.logger', array('channel' => 'cache'));
1074+
}
1075+
10651076
$this->addClassesToCompile(array(
10661077
'Psr\Cache\CacheItemInterface',
10671078
'Psr\Cache\CacheItemPoolInterface',

‎src/Symfony/Bundle/FrameworkBundle/Resources/config/property_access.xml

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Resources/config/property_access.xml
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<service id="property_accessor" class="Symfony\Component\PropertyAccess\PropertyAccessor" >
99
<argument /> <!-- magicCall, set by the extension -->
1010
<argument /> <!-- throwExceptionOnInvalidIndex, set by the extension -->
11+
<argument type="service" id="cache.property_access" on-invalid="ignore" />
1112
</service>
1213
</services>
1314
</container>

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.