[FrameworkBundle] Fallback to default cache system in production for serializer#18561
Merged
Merged
Conversation
Member
|
👍 |
Member
|
👍 |
Member
|
Thank you @tgalopin. |
nicolas-grekas
added a commit
that referenced
this pull request
Apr 19, 2016
…production for serializer (tgalopin) This PR was merged into the 3.1-dev branch. Discussion ---------- [FrameworkBundle] Fallback to default cache system in production for serializer | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - In the same idea as #18544, this PR proposes a default fallback to filesystem cache for the serializer if the APC cache is not enabled in production. In other words, if the following part of `config_prod.yml` file is not uncommented, the filesystem will be used: ``` yaml #framework: # serializer: # cache: serializer.mapping.cache.doctrine.apc ``` Commits ------- 4f0b8be [FrameworkBundle] Fallback to default cache system in production for serializer
| $chainLoader->replaceArgument(0, $serializerLoaders); | ||
|
|
||
| if (isset($config['cache']) && $config['cache']) { | ||
| if (!$container->getParameter('kernel.debug')) { |
Member
There was a problem hiding this comment.
This means I can never enable the cache during development. Is that intended?
Member
There was a problem hiding this comment.
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
2 tasks
nicolas-grekas
added a commit
that referenced
this pull request
Apr 27, 2016
…by the ClassMetadataFactory (Ener-Getick) This PR was merged into the 3.1-dev branch. Discussion ---------- [FrameworkBundle][Serializer] Fix a deprecation triggered by the ClassMetadataFactory | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | | License | MIT Without apparent reasons, [FOSRestBundle's tests fail](https://travis-ci.org/FriendsOfSymfony/FOSRestBundle/jobs/124384888) since #18561. ``` Passing a Doctrine Cache instance as 2nd parameter of the "Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory" constructor is deprecated. This parameter will be removed in Symfony 4.0. Use the "Symfony\Component\Serializer\Mapping\Factory\CacheClassMetadataFactory" class instead: 6x 1x in ErrorWithTemplatingFormatTest::testSerializeExceptionHtml from FOS\RestBundle\Tests\Functional 1x in SerializerErrorTest::testSerializeExceptionJson from FOS\RestBundle\Tests\Functional 1x in SerializerErrorTest::testSerializeExceptionJsonWithoutDebug from FOS\RestBundle\Tests\Functional 1x in SerializerErrorTest::testSerializeExceptionXml from FOS\RestBundle\Tests\Functional 1x in SerializerErrorTest::testSerializeInvalidFormJson from FOS\RestBundle\Tests\Functional 1x in SerializerErrorTest::testSerializeInvalidFormXml from FOS\RestBundle\Tests\Functional ``` We don't use cache in our tests but some of them are not in ``debug`` mode (will change soon) so the cache is automatically used. This PR fixes this deprecation by detecting if the cache used by the serializer is psr6 compliant or not (if it is, then it replaces the default metadata factory by an instance of the new class ``CacheClassMetadataFactory``, otherwise the second parameter of the ``ClassMetadataFactory`` is used). Commits ------- 15579d5 [FrameworkBundle] Deprecate framework.serializer.cache eccbffb [Serializer] Improve a deprecation message 96e418a Revert "[FrameworkBundle] Fallback to default cache system in production for serializer"
symfony-splitter
pushed a commit
to symfony/framework-bundle
that referenced
this pull request
Apr 27, 2016
…by the ClassMetadataFactory (Ener-Getick) This PR was merged into the 3.1-dev branch. Discussion ---------- [FrameworkBundle][Serializer] Fix a deprecation triggered by the ClassMetadataFactory | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | | License | MIT Without apparent reasons, [FOSRestBundle's tests fail](https://travis-ci.org/FriendsOfSymfony/FOSRestBundle/jobs/124384888) since symfony/symfony#18561. ``` Passing a Doctrine Cache instance as 2nd parameter of the "Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory" constructor is deprecated. This parameter will be removed in Symfony 4.0. Use the "Symfony\Component\Serializer\Mapping\Factory\CacheClassMetadataFactory" class instead: 6x 1x in ErrorWithTemplatingFormatTest::testSerializeExceptionHtml from FOS\RestBundle\Tests\Functional 1x in SerializerErrorTest::testSerializeExceptionJson from FOS\RestBundle\Tests\Functional 1x in SerializerErrorTest::testSerializeExceptionJsonWithoutDebug from FOS\RestBundle\Tests\Functional 1x in SerializerErrorTest::testSerializeExceptionXml from FOS\RestBundle\Tests\Functional 1x in SerializerErrorTest::testSerializeInvalidFormJson from FOS\RestBundle\Tests\Functional 1x in SerializerErrorTest::testSerializeInvalidFormXml from FOS\RestBundle\Tests\Functional ``` We don't use cache in our tests but some of them are not in ``debug`` mode (will change soon) so the cache is automatically used. This PR fixes this deprecation by detecting if the cache used by the serializer is psr6 compliant or not (if it is, then it replaces the default metadata factory by an instance of the new class ``CacheClassMetadataFactory``, otherwise the second parameter of the ``ClassMetadataFactory`` is used). Commits ------- 15579d5 [FrameworkBundle] Deprecate framework.serializer.cache eccbffb [Serializer] Improve a deprecation message 96e418a Revert "[FrameworkBundle] Fallback to default cache system in production for serializer"
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In the same idea as #18544, this PR proposes a default fallback to filesystem cache for the serializer if the APC cache is not enabled in production. In other words, if the following part of
config_prod.ymlfile is not uncommented, the filesystem will be used: