Skip to content

Fix PHP example on ExpressionLanguage Injection #13598

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
Apr 29, 2020

Conversation

jderusse
Copy link
Member

Current example does not work. generate service(App\Service) instead of service('App\\Service')
Missing quotes and \ escape

@javiereguiluz javiereguiluz changed the base branch from 5.0 to 4.4 April 29, 2020 15:18
@javiereguiluz javiereguiluz merged commit f086377 into symfony:4.4 Apr 29, 2020
@javiereguiluz
Copy link
Member

Jérémy, thanks for spotting this error. While merging I replaced the fix by:

            $services->set(Mailer::class)
                ->args([expr("service('App\\Mail\\MailerConfiguration').getMailerMethod()")]);

Although your solution is nice ... it introduces added complexity to an already complex example. So, I prefer to use the same syntax as in YAML and XML. It's true that we lost the nice ::class constant ... but the example know shows more clearly what you need to configure. It's up to the reader to come up with advanced alternatives like the one you showed. Thanks!

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.

3 participants