-
Notifications
You must be signed in to change notification settings - Fork 34
Imports
Mauro Gadaleta edited this page Feb 20, 2017
·
1 revision
If your application ends up having many services, this file becomes huge and hard to maintain. To avoid this, you can split your service configuration into multiple service files:
For example:
# app/config/services/mailer.yml
services:
app.mailer:
class: ./App/Mailer
arguments: ['mail_transport']
The definition itself hasn't changed, only its location. To make the service container load the definitions in this resource file, use the imports key in any already loaded resource
# app/config/services.yml
imports:
- { resource: services/mailer.yml }
- { resource: services/another.yml }
{
"imports": [
{"resource": "services/mailer.json"},
{"resource": "services/another.json"}
]
}
module.exports = {
imports: [
{resource: 'services/mailer.js'},
{resource: 'services/another.js'}
]
}
Copyright © 2023-2024 Mauro Gadaleta