-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Document the yaml_file usage #11121
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document the yaml_file usage #11121
Changes from 2 commits
d0e0e8f
235372c
a3914cf
8c4ed4e
31375d7
4fca3ae
9e30f61
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1072,6 +1072,44 @@ 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 | ||
---------------------------------------------- | ||
|
||
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\ServiceWithYamlInside: | ||
arguments: | ||
- !yaml_file '%kernel.root_dir%/some/file.yaml' | ||
|
||
.. code-block:: xml | ||
|
||
<!-- config/services.xml --> | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<container xmlns="http://symfony.com/schema/dic/services" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://symfony.com/schema/dic/services | ||
http://symfony.com/schema/dic/services/services-1.0.xsd"> | ||
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. Please use https here 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. None of the previous examples use https, sure about that one? 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. #11122 is on the go, any addition should be secure now. 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. Ok then, fixed! |
||
|
||
<services> | ||
<!-- ... --> | ||
|
||
<service id="my_service" class="App\ServiceWithYamlInside"> | ||
<argument type="yaml_file">%kernel.root_dir%/some/file.yaml</argument> | ||
HeahDude marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</service> | ||
</services> | ||
</container> | ||
|
||
You need the :doc:`YAML component </components/yaml>` to use this feature. | ||
|
||
Learn more | ||
---------- | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.