@@ -88,8 +88,10 @@ configuration files, even if they use a different format:
88
88
# config/services.yaml
89
89
imports :
90
90
- { 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 }
93
95
# glob expressions are also supported to load multiple files
94
96
- { resource: '/etc/myapp/*.yaml' }
95
97
@@ -108,8 +110,10 @@ configuration files, even if they use a different format:
108
110
109
111
<imports >
110
112
<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" />
113
117
<!-- glob expressions are also supported to load multiple files -->
114
118
<import resource =" /etc/myapp/*.yaml" />
115
119
</imports >
@@ -121,14 +125,20 @@ configuration files, even if they use a different format:
121
125
122
126
// config/services.php
123
127
$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
126
132
$loader->import('my_config_file.yaml', null, true);
127
133
// glob expressions are also supported to load multiple files
128
134
$loader->import('/etc/myapp/*.yaml');
129
135
130
136
// ...
131
137
138
+ .. versionadded :: 4.4
139
+
140
+ The ``not_found `` option value for ``ignore_errors `` was introduced in Symfony 4.4.
141
+
132
142
.. _config-parameter-intro :
133
143
.. _config-parameters-yml :
134
144
.. _configuration-parameters :
@@ -797,7 +807,7 @@ parameters at once by type-hinting any of its constructor arguments with the
797
807
798
808
// src/Service/MessageGenerator.php
799
809
namespace App\Service;
800
-
810
+
801
811
// ...
802
812
803
813
use Symfony\Component\DependencyInjection\ParameterBag\ContainerBagInterface;
0 commit comments