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

[FrameworkBundle] Fallback to default cache system in production for serializer #18561

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 19, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ private function addSerializerSection(ArrayNodeDefinition $rootNode)
->canBeEnabled()
->children()
->booleanNode('enable_annotations')->defaultFalse()->end()
->scalarNode('cache')->end()
->scalarNode('cache')->defaultValue('serializer.mapping.cache.symfony')->end()
->scalarNode('name_converter')->end()
->end()
->end()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,7 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder

$chainLoader->replaceArgument(0, $serializerLoaders);

if (isset($config['cache']) && $config['cache']) {
if (!$container->getParameter('kernel.debug')) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This means I can never enable the cache during development. Is that intended?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can, you just have to --env=prod
since there is no invalidation, enabling this cache in dev only creates WTFs :-)
We did a similar change for validation:
https://github.com/symfony/symfony/pull/18544/files#diff-0e793081ceb720201745c982a568903fL784

$container->setParameter(
'serializer.mapping.cache.prefix',
'serializer_'.$this->getKernelRootHash($container)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ protected static function getBundleDefaultConfig()
'serializer' => array(
'enabled' => false,
'enable_annotations' => false,
'cache' => 'serializer.mapping.cache.symfony',
),
'property_access' => array(
'magic_call' => false,
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.