Skip to content

[DependencyInjection] Fix example for Autowire attribute #17889

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

Merged
merged 1 commit into from
Feb 13, 2023

Conversation

W0rma
Copy link
Contributor

@W0rma W0rma commented Feb 10, 2023

I just noticed that the container will internally resolve the service name to "AppMailMailerConfiguration" if backslashes are not double-escaped.

@@ -629,7 +629,7 @@ and even :doc:`complex expressions </service_container/expression_language>`::
bool $debugMode,

// and expressions
#[Autowire(expression: 'service("App\\Mail\\MailerConfiguration").getMailerMethod()')]
#[Autowire(expression: 'service("App\\\\Mail\\\\MailerConfiguration").getMailerMethod()')]
Copy link
Contributor

@OskarStark OskarStark Feb 11, 2023

Choose a reason for hiding this comment

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

based on my experience, 3 slashes should be enough, can you please double check? Thanks

Copy link
Contributor

Choose a reason for hiding this comment

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

Here is a part of my code:
CleanShot 2023-02-11 at 13 27 10@2x

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@OskarStark Yes, 3 backslashes seem to be sufficient. Thank you for the hint!

@W0rma W0rma force-pushed the fix-example-autowire-expression branch from 4739903 to 7cac7e2 Compare February 13, 2023 07:49
@W0rma W0rma requested a review from OskarStark February 13, 2023 07:51
@OskarStark
Copy link
Contributor

Thank you @W0rma.

@OskarStark OskarStark merged commit e7ddfa6 into symfony:6.2 Feb 13, 2023
@W0rma W0rma deleted the fix-example-autowire-expression branch February 13, 2023 14:55
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.

4 participants