I'm using the following Symfony components:
"require": {
"symfony/dependency-injection": "~3.0",
"symfony/yaml": "~3.0",
"symfony/config": "~3.0",
"symfony/console": "~3.0",
"symfony/validator": "~3.0",
"symfony/event-dispatcher": "~3.0",
"guzzlehttp/guzzle": "~6.0",
"gedex/janrain-api": "~0.1",
"monolog/monolog": "~1.0"
},
I have a forms.yaml
and services.yaml
. Services config file has information about services to be loaded by DependencyInjection
component. But Forms config file has custom definition for my Forms
service (which uses a custom Configuration class.
I would like to know if I can merge services
and forms
into a single config.yaml
and still have the DependencyInjection
and Forms
get their configuration.
Thanks!
Anything defined in config.yaml
apart from parameters
, needs to be used by an Extension
.
The Extension
receives the config part that belongs to it (defined by the getAlias
method).
The extension then can call a Configurator
which will process a "well known" configuration, and you can add defaults, etc. This will return a config array.
You can then set a parameter in the container, having this configuration array. The container that the Extension receives is an empty one that then gets merged with the real one, receiving the parameters.
Then you can add a CompilerPass
and use these parameters to bind them to your service.