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

[FrameworkBundle] Remove redundantname attribute fromdefault_context#53657

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

HypeMC
Copy link
Member

@HypeMCHypeMC commentedJan 28, 2024
edited
Loading

QA
Branch?7.1
Bug fix?no
New feature?no
Deprecations?no
Issues-
LicenseMIT

This attributename doesn't exist. It's not defined in the XML schema, and it doesn't do anything.default_context is just a simple array that's passed to the serializer.

Enz000 reacted with rocket emoji
@smnandre
Copy link
Member

In YAML, the 'name' argument of useAttributeAsKey() has a special meaning and refers to the key of the map (sf_connection and default in this example). If a child node was defined for the connections node with the key name, then that key of the map would be lost.

Seehttps://symfony.com/doc/current/components/config/definition.html#array-node-options

@HypeMC
Copy link
MemberAuthor

HypeMC commentedJan 28, 2024
edited
Loading

@smnandre Well yes, it does make sense in the example, and in some other cases such asscoped_clients, but it still doesn't make sense for thedefault_context. You cannot do, for example, something like:

framework:serializer:default_context:            -name:oneenable_max_depth:trueyaml_indentation:2            -name:twoenable_max_depth:trueyaml_indentation:2

@smnandre
Copy link
Member

As i read it you can do the following:

framework:serializer:default_context:foo:barblop:blipname:name

@HypeMC
Copy link
MemberAuthor

@smnandre You can still do that even with this change.

@smnandre
Copy link
Member

As of writing this, there is an inconsistency: if only one file provides the configuration in question, the keys (i.e. sf_connection and default) are not lost. But if more than one file provides the configuration, the keys are lost as described above.

@HypeMC
Copy link
MemberAuthor

@smnandre Sorry, I'm not sure what the point of your last response was.

@nicolas-grekas
Copy link
Member

Let's change this on 7.1, this is not a bugfix to me.

@HypeMCHypeMCforce-pushed theserializer-remove-redundant-config branch fromfa46205 toaf31d97CompareJanuary 29, 2024 09:11
@HypeMCHypeMC changed the base branch from5.4 to7.1January 29, 2024 09:11
@HypeMCHypeMCforce-pushed theserializer-remove-redundant-config branch fromaf31d97 to485b756CompareJanuary 29, 2024 09:12
@HypeMC
Copy link
MemberAuthor

@nicolas-grekas Done

@chalasr
Copy link
Member

Thank you@HypeMC.

@chalasrchalasr merged commite00c12e intosymfony:7.1Jan 29, 2024
@smnandre
Copy link
Member

@smnandre Sorry, I'm not sure what the point of your last response was.

@HypeMC I've spend a looong time trying to reproduce a case where those keys were lost, justifiying this call... and failed massively. Will bring concrete evidence (if it exists) before commenting next time.. Sorry for that, lesson learned.

@HypeMCHypeMC deleted the serializer-remove-redundant-config branchJanuary 30, 2024 02:22
@HypeMC
Copy link
MemberAuthor

@smnandre No worries, better safe than sorry, thanks for investigating 😄

nicolas-grekas added a commit that referenced this pull requestAug 12, 2024
…m `default_context` (HypeMC)This PR was merged into the 7.1 branch.Discussion----------[FrameworkBundle] Re-remove redundant name attribute from `default_context`| Q             | A| ------------- | ---| Branch?       | 7.1| Bug fix?      | no| New feature?  | no| Deprecations? | no| Issues        | -| License       | MITThis was originally removed in#53657 but was later reintroduced in v7.1.2, likely by accident, in the following merge commit:67ac926.Commits-------83fe767 [FrameworkBundle] Re-remove redundant name attribute from `default_context`
@wouterj
Copy link
Member

Let's change this on 7.1, this is not a bugfix to me.

A test on documentation examples revealed that this does create a weird situation when using the config builders.

TheuseAttributeAsKey signals the config builders that we expect a mapping with a key. Which creates a method with 2 arguments rather than 1.

E.g. the following snippet does not work on 6.4:

returnstaticfunction (FrameworkConfig$framework):void {$framework->serializer()        ->defaultContext(['allow_extra_attributes' =>false,        ])    ;};

And a user has to do something like:

returnstaticfunction (FrameworkConfig$framework):void {$framework->serializer()        ->defaultContext('can be anything as this is not used', ['allow_extra_attributes' =>false,        ])    ;};

I think we can consider this a bugfix for 6.4, what do you think?

fabpot added a commit that referenced this pull requestMar 17, 2025
…default_context` (HypeMC)This PR was merged into the 6.4 branch.Discussion----------[FrameworkBundle] Remove redundant `name` attribute from `default_context`| Q             | A| ------------- | ---| Branch?       | 6.4| Bug fix?      | yes?| New feature?  | no| Deprecations? | no| Issues        | -| License       | MITThis was initially merged into v7.1 in#53657. However, after seeing `@wouterj`'s [comment](#53657 (comment)) (which I missed earlier), I opened this PR to see if we might want to reconsider this as a bug after all.Commits-------f71a850 [FrameworkBundle] Remove redundant `name` attribute from `default_context`
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

@chalasrchalasrchalasr approved these changes

@lyrixxlyrixxAwaiting requested review from lyrixx

@ycerutoycerutoAwaiting requested review from yceruto

@dunglasdunglasAwaiting requested review from dunglas

@xabbuhxabbuhAwaiting requested review from xabbuh

Assignees
No one assigned
Projects
None yet
Milestone
7.1
Development

Successfully merging this pull request may close these issues.

6 participants
@HypeMC@smnandre@nicolas-grekas@chalasr@wouterj@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp