Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork5.3k
Use the new configurator YAML syntax#7203
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
| class:AppBundle\Mail\NewsletterManager | ||
| arguments:['@mailer'] | ||
| configurator:['@app.email_configurator',configure] | ||
| configurator:'app.email_configurator:configure' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
you actually have to use two colons
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Like this?
configurator: 'app.email_configurator::configure'There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
@xabbuh that's not true. 2 colons are used when doing a callable referencing a static method (the PHP standard notationClass::staticMethod). The shortcut syntax for service method callables uses a single colon (i.e. something which cannot appear in a valid PHP callable), as done already for the routing configuration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Sorry for the confusion Javier.@stof is indeed right.
xabbuh commentedDec 1, 2016
I think we should then document this notation for factories too. |
| class:AppBundle\Mail\NewsletterManager | ||
| arguments:['@mailer'] | ||
| configurator:['@app.email_configurator',configure] | ||
| configurator:'app.email_configurator:configure' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
@xabbuh that's not true. 2 colons are used when doing a callable referencing a static method (the PHP standard notationClass::staticMethod). The shortcut syntax for service method callables uses a single colon (i.e. something which cannot appear in a valid PHP callable), as done already for the routing configuration.
| ->setConfigurator(array(new Reference('app.email_configurator'), 'configure')) | ||
| ; | ||
| ..note:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
shouldn't it beversionadded ?
javiereguiluz commentedDec 1, 2016
service_container/configurators.rst Outdated
| # old syntax | ||
| configurator:['@app.email_configurator', configure] | ||
| ..versionadded::3.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Theversionadded directive nested in thenote block doesn't look very nice. What about instead transforming thenote into aversionadded instead as@stof suggested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Done!
xabbuh commentedApr 15, 2017
Thank you Javier. |
* 3.2: (71 commits) Rewriting the service container docs Minor reword Adding a tip for validation in forms without class [#7217] add versionadded directives [#7203] merge note and versionadded directive Use the new configurator YAML syntax Added a note about the .htaccess files included by Symfony apps Made unmapped field example in forms chapter more descriptive [#7507] fix namespace [#7507] fix component name [#7490] minor typo fix Added a note about redirections to absolute URLs in tests [#7204] link to API doc Added docs for JsonResponse::fromJsonString Added the changes suggested by reviewers [#7620] use generate() in PHP templates before 2.8 Fixed the RST syntax Improve example context Minor formatting changes [#7519] some minor tweaks ...
…rekas)This PR was merged into the 4.2 branch.Discussion----------Remove short factories/configurators examplesThis PR reverts#7203, as short factories are more confusing than useful.I'm proposing to deprecate them insymfony/symfony#31543Note that some of this patch can (should) be adapted to 3.4 also.Commits-------e8cfa6e Remove short factories/configurators examples
Thisfixes#7176.