-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -127,12 +127,12 @@ You can configure the service configurator using the ``configurator`` option: | |||
app.newsletter_manager: | |||
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 notation Class::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.
I think we should then document this notation for factories too. |
@@ -127,12 +127,12 @@ You can configure the service configurator using the ``configurator`` option: | |||
app.newsletter_manager: | |||
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 notation Class::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.
@@ -186,6 +186,20 @@ You can configure the service configurator using the ``configurator`` option: | |||
->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 be versionadded
?
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.
The versionadded
directive nested in the note
block doesn't look very nice. What about instead transforming the note
into a versionadded
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!
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 examples This PR reverts #7203, as short factories are more confusing than useful. I'm proposing to deprecate them in symfony/symfony#31543 Note that some of this patch can (should) be adapted to 3.4 also. Commits ------- e8cfa6e Remove short factories/configurators examples
This fixes #7176.