-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Serializer] Add PSR-6 adapter #17446
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
Conversation
dunglas
commented
Jan 19, 2016
Q | A |
---|---|
Bug fix? | no |
New feature? | yes |
BC breaks? | no |
Deprecations? | yes |
Tests pass? | yes |
Fixed tickets | n/a |
License | MIT |
Doc PR | todo |
- Add tests
public function getMetadataFor($value) | ||
{ | ||
$class = $this->getClass($value); | ||
// Key cannot contains backslashes according to PSR-6 |
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.
cannot contains
-> cannot contain
Please mark unfinished PRs with "[WIP]". |
*/ | ||
|
||
namespace Symfony\Component\Serializer\Mapping\Factory; | ||
use Psr\Cache\CacheItemPoolInterface; |
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.
missing space
63a7431
to
b609714
Compare
This PR is now ready to be merged. |
@@ -44,6 +46,10 @@ public function __construct(LoaderInterface $loader, Cache $cache = null) | |||
{ | |||
$this->loader = $loader; | |||
$this->cache = $cache; | |||
|
|||
if (null !== $cache) { | |||
@trigger_error('Passing a Doctrine Cache instance as 2nd parameter of the "Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface" is deprecated. This parameter will be removed in Symfony 4.0. Use the "Symfony\Component\Serializer\Mapping\Factory\CacheMetadataFactory" class instead.', E_USER_DEPRECATED); |
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.
It seems that you are as tired as I am 😉 The second FQN must be the new one (and BTW you can use sprintf with __CLASS__
/ ::class)
@dunglas Can you finish this one? |
b609714
to
355f48c
Compare
Should be finished now. |
"doctrine/annotations": "~1.0", | ||
"doctrine/cache": "~1.0" | ||
}, | ||
"suggest": { | ||
"doctrine/annotations": "For using the annotation mapping. You will also need doctrine/cache.", | ||
"doctrine/cache": "For using the default cached annotation reader and metadata cache.", | ||
"symfony/cache": "For using the metadata 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.
On the validator PR, you added "psr/cache-implementation": "For using the metadata cache.",
instead. Not that it matters so much, but for consistency, we should do the same everywhere.
@fabpot replaced |
Thank you @dunglas. |
{ | ||
$metadata = new ClassMetadata('Symfony\Component\Serializer\Tests\Fixtures\Dummy'); | ||
|
||
$decorated = $this->getMock('Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface'); |
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.
::class
should be used
This PR was merged into the 3.1-dev branch. Discussion ---------- [Serializer] Use ::class in new tests | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #17446 (comment) | License | MIT | Doc PR | n/a Commits ------- 48e8041 [Serializer] Use ::class in new tests
This PR was merged into the 3.1-dev branch. Discussion ---------- [Serializer] Use ::class in new tests | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | symfony/symfony#17446 (comment) | License | MIT | Doc PR | n/a Commits ------- 48e8041 [Serializer] Use ::class in new tests