Skip to content

Commit f6de406

Browse files
committed
[Configuration] Add documentation about ignore_errors: not_found option.
1 parent dd656d9 commit f6de406

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

configuration.rst

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,10 @@ configuration files, even if they use a different format:
8888
# config/services.yaml
8989
imports:
9090
- { resource: 'legacy_config.php' }
91-
# ignore_errors silently discards errors if the loaded file doesn't exist
92-
- { resource: 'my_config_file.xml', ignore_errors: true }
91+
# ignore_errors: not_found silently discards errors if the loaded file doesn't exist
92+
- { resource: 'my_config_file.xml', ignore_errors: not_found }
93+
# ignore_errors: true silently discards errors if the loaded file doesn't exist or contains invalid code
94+
- { resource: 'my_other_config_file.xml', ignore_errors: true }
9395
# glob expressions are also supported to load multiple files
9496
- { resource: '/etc/myapp/*.yaml' }
9597
@@ -108,8 +110,10 @@ configuration files, even if they use a different format:
108110
109111
<imports>
110112
<import resource="legacy_config.php"/>
111-
<!-- ignore_errors silently discards errors if the loaded file doesn't exist -->
112-
<import resource="my_config_file.yaml" ignore-errors="true"/>
113+
<!-- ignore-errors="not_found" silently discards errors if the loaded file doesn't exist -->
114+
<import resource="my_config_file.yaml" ignore-errors="not_found"/>
115+
<!-- ignore-errors="true" silently discards errors if the loaded file doesn't exist or contains invalid code -->
116+
<import resource="my_other_config_file.yaml" ignore-errors="true"/>
113117
<!-- glob expressions are also supported to load multiple files -->
114118
<import resource="/etc/myapp/*.yaml"/>
115119
</imports>
@@ -121,14 +125,20 @@ configuration files, even if they use a different format:
121125
122126
// config/services.php
123127
$loader->import('legacy_config.xml');
124-
// the third optional argument of import() is 'ignore_errors', which
125-
// silently discards errors if the loaded file doesn't exist
128+
// the third optional argument of import() is 'ignore_errors'
129+
// 'ignore_errors' set to 'not_found' silently discards errors if the loaded file doesn't exist
130+
$loader->import('my_config_file.yaml', null, 'not_found');
131+
// 'ignore_errors' set to true silently discards errors if the loaded file doesn't exist or contains invalid code
126132
$loader->import('my_config_file.yaml', null, true);
127133
// glob expressions are also supported to load multiple files
128134
$loader->import('/etc/myapp/*.yaml');
129135
130136
// ...
131137
138+
.. versionadded:: 4.4
139+
140+
The ``not_found`` option value for ``ignore_errors`` was introduced in Symfony 4.4.
141+
132142
.. _config-parameter-intro:
133143
.. _config-parameters-yml:
134144
.. _configuration-parameters:
@@ -797,7 +807,7 @@ parameters at once by type-hinting any of its constructor arguments with the
797807

798808
// src/Service/MessageGenerator.php
799809
namespace App\Service;
800-
810+
801811
// ...
802812

803813
use Symfony\Component\DependencyInjection\ParameterBag\ContainerBagInterface;

0 commit comments

Comments
 (0)