https://symfony.com/doc/current/service_container.html
services:
site_update_manager.superadmin:
class: App\Updates\SiteUpdateManager
# you CAN still use autowiring: we just want to show what it looks like without
autowire: false
# manually wire all arguments
arguments:
- '@App\Service\MessageGenerator'
- '@mailer'
- 'superadmin@example.com'
parameters:
admin_email: manager@example.com
services:
site_update_manager.superadmin:
class: App\Updates\SiteUpdateManager
arguments:
$adminEmail: '%admin_email%'
https://symfony.com/doc/current/service_container/calls.html
services:
class: App\Service\MessageGenerator:
# ...
calls:
- method: setLogger
arguments:
- '@logger'
Provide argument from the result of calling other service/ Inject Values Based on Complex Expressions.
https://symfony.com/doc/current/service_container/expression_language.html
# config/services.yaml
services:
class: App\Mail\MailerConfiguration: ~
class: App\Mailer:
arguments: ["@=service('App\\\\Mail\\\\MailerConfiguration').getMailerMethod()"]
http://symfony.com/doc/current/service_container/factories.html
services:
# ...
App\Email\NewsletterManagerFactory: ~
App\Email\NewsletterManager:
# call a method on the specified factory service
factory: 'App\Email\NewsletterManagerFactory:createNewsletterManager'
https://symfony.com/doc/current/service_container/parent_services.html
https://symfony.com/doc/current/service_container/configurators.html#using-the-configurator
todo?