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.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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' | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. you actually have to use two colons MemberAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Like this? Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. yes Member There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Sorry for the confusion Javier.@stof is indeed right. | ||
| app.greeting_card_manager: | ||
| class: AppBundle\Mail\GreetingCardManager | ||
| arguments: ['@mailer'] | ||
| configurator:'app.email_configurator:configure' | ||
| .. code-block:: xml | ||
| @@ -186,6 +186,23 @@ You can configure the service configurator using the ``configurator`` option: | ||
| ->setConfigurator(array(new Reference('app.email_configurator'), 'configure')) | ||
| ; | ||
| .. note:: | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. shouldn't it be | ||
| The traditional configurator syntax in YAML files used an array to define | ||
| the service id and the method name: | ||
| .. code-block:: yaml | ||
| app.newsletter_manager: | ||
| # new syntax | ||
| configurator: 'app.email_configurator:configure' | ||
| # old syntax | ||
| configurator: ['@app.email_configurator', configure] | ||
| .. versionadded:: 3.2 | ||
| The ``service_id:method_name`` syntax for the YAML configuration format | ||
| was introduced in Symfony 3.2. | ||
| That's it! When requesting the ``app.newsletter_manager`` or | ||
| ``app.greeting_card_manager`` service, the created instance will first be | ||
| passed to the ``EmailConfigurator::configure()`` method. | ||