[FrameworkBundle] Fallback to default cache system in production for serializer
This commit is contained in:
parent
47cb0c3ec1
commit
4f0b8beea6
@ -513,7 +513,7 @@ class Configuration implements ConfigurationInterface
|
||||
->canBeEnabled()
|
||||
->children()
|
||||
->booleanNode('enable_annotations')->defaultFalse()->end()
|
||||
->scalarNode('cache')->end()
|
||||
->scalarNode('cache')->defaultValue('serializer.mapping.cache.symfony')->end()
|
||||
->scalarNode('name_converter')->end()
|
||||
->end()
|
||||
->end()
|
||||
|
@ -982,7 +982,7 @@ class FrameworkExtension extends Extension
|
||||
|
||||
$chainLoader->replaceArgument(0, $serializerLoaders);
|
||||
|
||||
if (isset($config['cache']) && $config['cache']) {
|
||||
if (!$container->getParameter('kernel.debug')) {
|
||||
$container->setParameter(
|
||||
'serializer.mapping.cache.prefix',
|
||||
'serializer_'.$this->getKernelRootHash($container)
|
||||
|
@ -25,6 +25,10 @@
|
||||
<tag name="cache.pool" clearer="cache.default_pools_clearer" />
|
||||
</service>
|
||||
|
||||
<service id="cache.pool.serializer" parent="cache.adapter.local" public="false">
|
||||
<tag name="cache.pool" clearer="cache.default_pools_clearer" />
|
||||
</service>
|
||||
|
||||
<service id="cache.adapter.apcu" class="Symfony\Component\Cache\Adapter\ApcuAdapter" abstract="true">
|
||||
<argument /> <!-- namespace -->
|
||||
<argument /> <!-- default lifetime -->
|
||||
|
@ -38,6 +38,10 @@
|
||||
</service>
|
||||
|
||||
<!-- Cache -->
|
||||
<service id="serializer.mapping.cache.symfony" class="Symfony\Component\Cache\DoctrineProvider" public="false">
|
||||
<argument type="service" id="cache.pool.serializer" />
|
||||
</service>
|
||||
|
||||
<service id="serializer.mapping.cache.apc" class="Doctrine\Common\Cache\ApcCache" public="false">
|
||||
<call method="setNamespace">
|
||||
<argument>%serializer.mapping.cache.prefix%</argument>
|
||||
|
@ -221,6 +221,7 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase
|
||||
'serializer' => array(
|
||||
'enabled' => false,
|
||||
'enable_annotations' => false,
|
||||
'cache' => 'serializer.mapping.cache.symfony',
|
||||
),
|
||||
'property_access' => array(
|
||||
'magic_call' => false,
|
||||
|
Reference in New Issue
Block a user