Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

[Serializer] Allow to access extra infos in name converters#27021

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

Merged

Conversation

@dunglas
Copy link
Member

@dunglasdunglas commentedApr 23, 2018
edited
Loading

QA
Branch?master
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed ticketsn/a
LicenseMIT
Doc PRsymfony/symfony-docs#10317

Similar to#27017 and#27020 but for name converters.

ping@meyerbaptiste

ogizanagi reacted with thumbs up emoji
{
publicfunctiontestImplem()
{
$p =$this->prophesize(AdvancedNameConverterInterface::class);
Copy link
Contributor

Choose a reason for hiding this comment

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

Still WIP I guess 😄
Also we don't use prophecy in symfony core test suite.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Oops, I don't want to commit this file (yes I know for prophecy :(, it would be the perfect fit here).

/**
* {@inheritdoc}
*/
publicfunctionnormalize($propertyName, ?string$class =null, ?string$format =null,array$context =array());

Choose a reason for hiding this comment

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

the? should be removed, they are duplicate info (same below)

*
* @author Kévin Dunglas <dunglas@gmail.com>
*/
interface AdvancedNameConverterInterfaceextends NameConverterInterface

Choose a reason for hiding this comment

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

where is this used?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Nowhere, it's to be used in userland projects, we don't have this need in Symfony directly.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I added a test to highlight the expected usage.

@dunglasdunglasforce-pushed theserializer-name-converter-extra branch 5 times, most recently fromb9f10a1 to588b68bCompareJuly 3, 2018 20:17
@dunglasdunglasforce-pushed theserializer-name-converter-extra branch from588b68b to303dc63CompareJuly 13, 2018 11:53
@dunglas
Copy link
MemberAuthor

conflict fixed

Copy link
Member

@fabpotfabpot left a comment

Choose a reason for hiding this comment

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

I think it deserves a related PR for the docs.

-----

*`AbstractNormalizer::handleCircularReference` is now final, and receives two optional extra arguments: the format and the context
* added`AdvancedNameConverterInterface` to access to the class, the format and the context in a name converter
Copy link
Member

Choose a reason for hiding this comment

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

...to access the class...

namespaceSymfony\Component\Serializer\NameConverter;

/**
* Gives access to the format and the context in the property name converters.
Copy link
Member

Choose a reason for hiding this comment

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

class is missing here

@dunglas
Copy link
MemberAuthor

@fabpot comments fixed, I'll do the doc PR.

@fabpotfabpotforce-pushed theserializer-name-converter-extra branch fromfe7ff09 to57fe017CompareSeptember 4, 2018 13:37
@fabpot
Copy link
Member

Thank you@dunglas.

@fabpotfabpot merged commit57fe017 intosymfony:masterSep 4, 2018
fabpot added a commit that referenced this pull requestSep 4, 2018
…rters (dunglas)This PR was squashed before being merged into the 4.2-dev branch (closes#27021).Discussion----------[Serializer] Allow to access extra infos in name converters| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes<!-- don't forget to update src/**/CHANGELOG.md files -->| BC breaks?    | no     <!-- seehttps://symfony.com/bc -->| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->| Fixed tickets | n/a| License       | MIT| Doc PR        | todoSimilar to#27017 and#27020 but for name converters.ping@meyerbaptisteCommits-------57fe017 [Serializer] Allow to access extra infos in name converters
@javiereguiluz
Copy link
Member

I've createdsymfony/symfony-docs#10273 to document this new feature. Please, don't forget to create a doc issue for every new feature.

Kévin, if you can't contribute the docs for this, please share some examples of this feature in action or some extended explanation. Thanks!

javiereguiluz added a commit to symfony/symfony-docs that referenced this pull requestSep 11, 2018
…ers (dunglas, javiereguiluz)This PR was merged into the master branch.Discussion----------[Serializer] Allow to access extra infos in name converterssymfony/symfony#27021Commits-------71afdca Minor rewordae63f8a Add a note blockca5e2e0 [Serializer] Allow to access extra infos in name converters
dunglas added a commit that referenced this pull requestOct 5, 2018
…properties through metadata (fbourigault)This PR was squashed before being merged into the 4.2-dev branch (closes#28505).Discussion----------[Serialized] allow configuring the serialized name of properties through metadata| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#15171| License       | MIT| Doc PR        |symfony/symfony-docs#10422This leverage the new `AdvancedNameConverterInterface` interface (#27021) to implement a name converter that relies on metadata. The name to use is configured per property using a `@SerializedName` annotation or the `serialized-name` XML attribute or the `serialized_name` key for YAML.This was exposed by@dunglas in#19374 (comment).# Framework integrationFor FramworkBundle integration, a ChainNameConverter could be added to allow users to use this name converter with a custom one.# To do- [x] add a CHANGELOG.md entry.- [x] add a fallback.- [x] add framework integration.- [x] add local caching to `MetadataAwareNameConverter`.- [x] add a doc PR.Commits-------d1d1ceb [Serialized] allow configuring the serialized name of properties through metadata
@nicolas-grekasnicolas-grekas modified the milestones:next,4.2Nov 1, 2018
This was referencedNov 3, 2018
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas left review comments

@fabpotfabpotfabpot approved these changes

+1 more reviewer

@ogizanagiogizanagiogizanagi left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

4.2

Development

Successfully merging this pull request may close these issues.

6 participants

@dunglas@fabpot@javiereguiluz@nicolas-grekas@ogizanagi@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp