Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[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

Closed
wants to merge 4 commits into from
Closed

Conversation

dunglas
Copy link
Member

@dunglas 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
Copy link
Member

Choose a reason for hiding this comment

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

cannot contains -> cannot contain

@Tobion
Copy link
Contributor

Tobion commented Jan 19, 2016

Please mark unfinished PRs with "[WIP]".

@dunglas dunglas changed the title [Serializer] Add PSR-6 adapter [WIP] [Serializer] Add PSR-6 adapter Jan 19, 2016
*/

namespace Symfony\Component\Serializer\Mapping\Factory;
use Psr\Cache\CacheItemPoolInterface;
Copy link
Contributor

Choose a reason for hiding this comment

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

missing space

@dunglas dunglas changed the title [WIP] [Serializer] Add PSR-6 adapter [Serializer] Add PSR-6 adapter Jan 19, 2016
@dunglas
Copy link
Member Author

dunglas commented Jan 19, 2016

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);
Copy link
Contributor

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)

@fabpot
Copy link
Member

fabpot commented Jan 25, 2016

@dunglas Can you finish this one?

@dunglas
Copy link
Member Author

dunglas commented Jan 26, 2016

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.",
Copy link
Member

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.

@dunglas
Copy link
Member Author

dunglas commented Jan 26, 2016

@fabpot replaced symfony/cache by psr/cache-implementation in suggest.

@fabpot
Copy link
Member

fabpot commented Jan 27, 2016

Thank you @dunglas.

@fabpot fabpot closed this in cb16bff Jan 27, 2016
@dunglas dunglas deleted the serializer_psr6 branch January 27, 2016 07:13
{
$metadata = new ClassMetadata('Symfony\Component\Serializer\Tests\Fixtures\Dummy');

$decorated = $this->getMock('Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface');
Copy link
Contributor

Choose a reason for hiding this comment

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

::class should be used

fabpot added a commit that referenced this pull request Jan 27, 2016
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
symfony-splitter pushed a commit to symfony/serializer that referenced this pull request Jan 27, 2016
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
@fabpot fabpot mentioned this pull request May 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants