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

[DependencyInjection]#[Autowire] attribute should have precedence over bindings#51559

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

Conversation

HypeMC
Copy link
Member

QA
Branch?6.3
Bug fix?yes
New feature?no
Deprecations?no
TicketsFix#49082
LicenseMIT
Doc PR-

It seems logical (I think) that the#[Autowire] attribute has precedence over any bindings.

jerowork and zmitic reacted with hooray emoji
@ruudk
Copy link
Contributor

Thanks for fixing this 🙏 . Could you rebase this?

@HypeMCHypeMCforce-pushed thefix-autowire-attribute-with-bindings branch fromb9bacf2 to57f4b25CompareNovember 30, 2023 15:29
@stof
Copy link
Member

@nicolas-grekas is it right to have to make ResolveBindingPass aware of the Autowire attribute ? Shouldn't this be handled by the AutowirePass ?

@nicolas-grekas
Copy link
Member

I agree, the bindings pass has no reasons to know about autowiring stuff.
Can't we fix this by changing the order of the two passes?

@HypeMC
Copy link
MemberAuthor

@nicolas-grekas@stof My initial approach was to fix it inAutowirePass. I don't remember the exact reason, but I couldn't do it like that so I went with this instead.

I can try to change the order of the passes, but I'm worried that might break other stuff. I'll try it sometime today or tomorrow.

@nicolas-grekas
Copy link
Member

nicolas-grekas commentedNov 30, 2023
edited
Loading

It's also not obvious to me what we want here.

What this PR achieves is this precedence, isn't it?

  1. autowiring by attribute
  2. binding by type+name of argument
  3. binding by type only
  4. autowiring by type+name of argument
  5. autowiring by type only

Dunno if we should account for that but bindings can also be defined by explicit configuration and/or by autoconfiguration.

Dunno how we can make AutowirePass achieve this ordering (or another) given that once bindings are resolved, we don't know if some argument's values came through bindings or via another path (explicit/auto config).

Maybe this approach is the most pragmatic.

WDYT?

@HypeMCHypeMCforce-pushed thefix-autowire-attribute-with-bindings branch from57f4b25 toc429fe5CompareDecember 1, 2023 20:36
@nicolas-grekas
Copy link
Member

Any other opinion here?@stof?

@nicolas-grekas
Copy link
Member

Thank you@HypeMC.

@nicolas-grekasnicolas-grekas merged commiteb32f49 intosymfony:6.3Jan 30, 2024
@HypeMCHypeMC deleted the fix-autowire-attribute-with-bindings branchJanuary 30, 2024 09:52
This was referencedJan 30, 2024
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

Assignees
No one assigned
Projects
None yet
Milestone
6.3
Development

Successfully merging this pull request may close these issues.

6 participants
@HypeMC@ruudk@stof@nicolas-grekas@chalasr@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp