diff --git a/service_container.rst b/service_container.rst index 6983ea058f6..c55d135702e 100644 --- a/service_container.rst +++ b/service_container.rst @@ -1072,6 +1072,49 @@ If you want to pass the second, you'll need to :ref:`manually wire the service < and the automatically loaded service will be passed - by default - when you type-hint ``SiteUpdateManager``. That's why creating the alias is a good idea. +Injecting the content of YAML file as argument +---------------------------------------------- + +.. versionadded:: 4.3 + + Support for the YAML file notation in YAML and XML was introduced + in Symfony 4.3. + +You can automatically parse a YAML file and injecting it as an argument by referencing the **absolute path** to the file, +or the relative path from **your configuration file**: + +.. configuration-block:: + + .. code-block:: yaml + + # config/services.yaml + services: + # ... + + App\ServiceWithArrayConfigFromYamlFile: + arguments: + - !yaml_file '%kernel.root_dir%/some/file.yaml' + + .. code-block:: xml + + + + + + + + + + %kernel.root_dir%/some/file.yaml + + + + +You need the :doc:`YAML component ` to use this feature. + Learn more ----------