Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[FrameworkBundle][Serializer] Fix a deprecation triggered by the ClassMetadataFactory#18630
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
GuilhemN commentedApr 24, 2016
The tests failure seems unrelated. |
| ->children() | ||
| ->booleanNode('enable_annotations')->defaultFalse()->end() | ||
| ->scalarNode('cache')->defaultValue('serializer.mapping.cache.symfony')->end() | ||
| ->scalarNode('cache')->defaultValue('cache.pool.serializer')->end() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
this is a BC break to me, isn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
If this is merged in 3.1 where it was introduced, then I think it isn't.
javiereguiluz commentedApr 25, 2016
@Ener-Getick please, don't remove any of the rows of the PR table. In your table we miss the |
GuilhemN commentedApr 25, 2016
@javiereguiluz I thought it was enough to target the right branch, added ☺ |
| { | ||
| public function process(ContainerBuilder $container) | ||
| { | ||
| if (!$container->hasAlias('serializer.mapping.cache') && !$container->hasDefinition('serializer.mapping.cache')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
You can just use$container->has('serializer.mapping.cache').
xabbuh commentedApr 25, 2016
Can't we always use the |
nicolas-grekas commentedApr 25, 2016
Understood, this is for 3.1 :)
|
nicolas-grekas commentedApr 25, 2016
If we don't want to deprecate the cache configuration key, then I'd suggest doing what@xabbuh suggests, and do it at runtime using a static method as factory added to |
xabbuh commentedApr 25, 2016
I agree with@nicolas-grekas. Now that we have the |
GuilhemN commentedApr 25, 2016 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@nicolas-grekas@xabbuh then the default value introduced in#18561 should be removed right ? |
nicolas-grekas commentedApr 25, 2016
Yep, can you do that in this PR, as a first commit? |
GuilhemN commentedApr 25, 2016
@nicolas-grekas yes, I'm gonna split my commit |
| if (!$container->getParameter('kernel.debug')) { | ||
| if (isset($config['cache']) &&$config['cache']) { | ||
| @trigger_error('Using the option "framework.serializer.cache" is deprecated since version 3.1. This option will be removed in 4.0. You can configure a cache pool called "serializer" under "framework.cache" instead.',E_USER_DEPRECATED); |
nicolas-grekasApr 25, 2016 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
What about:
The "framework.serializer.cache" option is deprecated since Symfony 3.1 and will be removed in 4.0. You can configure a cache pool called "serializer" under "framework.cache.pools" instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
LGTM 👍
205f808 to0d7ecc7Compare…ion for serializer"This reverts commit4f0b8be.
60d94c6 tof44cb14CompareGuilhemN commentedApr 25, 2016 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Rebased and updated. I also added notes in the upgrading files to inform about this new deprecation. |
| $this->assertFalse($container->hasDefinition('serializer.mapping.cache_class_metadata_factory')); | ||
| } | ||
| publicfunctiontestDeprecatedSerializerCacheOption() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Should be tagged@group legacy so that we don't forget removing it when preparing 4.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
done
| @@ -0,0 +1,8 @@ | |||
| <?php | |||
| $container->loadFromExtension('framework', array( | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I suggest adding the "legacy" word in these fixtures so we can easily find them when preparing 4.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I mean in the filename
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
👍, renamed toserializer_legacy_cache
nicolas-grekas commentedApr 25, 2016
👍 with only one wonder: should the UPGRADE files tell about the serializer pool, and/or tell about |
GuilhemN commentedApr 25, 2016
I didn't think about |
| ```yaml | ||
| framework: | ||
| serializer:~ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
this level should be removed,cache is a direct child offramework
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
no it should not be removed. If you remove theserializer key entirely, it disables the serializer in FrameworkBundle
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
nicolas-grekas commentedApr 27, 2016
Thank you @Ener-Getick. |
…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 | MITWithout 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.cacheeccbffb [Serializer] Improve a deprecation message96e418a Revert "[FrameworkBundle] Fallback to default cache system in production for serializer"
… regressions (Ener-Getick)This PR was merged into the 3.1-dev branch.Discussion----------[FrameworkBundle] Fix a typo and add a test to prevent new regressions| Q | A| ------------- | ---| Branch? | master| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets || License | MIT| Doc PR |This fixes a typo introduced in#18630 and adds a new functional test to avoid most regressions in service definitions in the future when features are only available in non-debug mode.cc@nicolas-grekasCommits-------61872ce Fix a typo and add a check to prevent regressions
…r-Getick)This PR was merged into the 3.1-dev branch.Discussion----------Do not use validator.cache and serializer.cache anymore``framework.serializer.cache`` has been deprecated insymfony/symfony#18630 in favor of the new caching system.seesymfony/symfony#18630Commits-------e7a2085 Use the new cache system configuration
Uh oh!
There was an error while loading.Please reload this page.
Without apparent reasons,FOSRestBundle's tests fail since#18561.
We don't use cache in our tests but some of them are not in
debugmode (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 theClassMetadataFactoryis used).