@@ -88,11 +88,15 @@ 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
+
93
92
# glob expressions are also supported to load multiple files
94
93
- { resource: '/etc/myapp/*.yaml' }
95
94
95
+ # ignore_errors: not_found silently discards errors if the loaded file doesn't exist
96
+ - { resource: 'my_config_file.xml', ignore_errors: not_found }
97
+ # ignore_errors: true silently discards all errors (including invalid code and not found)
98
+ - { resource: 'my_other_config_file.xml', ignore_errors: true }
99
+
96
100
# ...
97
101
98
102
.. code-block :: xml
@@ -108,10 +112,13 @@ configuration files, even if they use a different format:
108
112
109
113
<imports >
110
114
<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
115
<!-- glob expressions are also supported to load multiple files -->
114
116
<import resource =" /etc/myapp/*.yaml" />
117
+
118
+ <!-- ignore-errors="not_found" silently discards errors if the loaded file doesn't exist -->
119
+ <import resource =" my_config_file.yaml" ignore-errors =" not_found" />
120
+ <!-- ignore-errors="true" silently discards all errors (including invalid code and not found) -->
121
+ <import resource =" my_other_config_file.yaml" ignore-errors =" true" />
115
122
</imports >
116
123
117
124
<!-- ... -->
@@ -124,14 +131,23 @@ configuration files, even if they use a different format:
124
131
125
132
return static function (ContainerConfigurator $container) {
126
133
$container->import('legacy_config.php');
127
- // ignore_errors (3rd parameter) silently discards errors if the loaded file doesn't exist
128
- $container->import('my_config_file.xml', null, true);
134
+
129
135
// glob expressions are also supported to load multiple files
130
136
$container->import('/etc/myapp/*.yaml');
137
+
138
+ // the third optional argument of import() is 'ignore_errors'
139
+ // 'ignore_errors' set to 'not_found' silently discards errors if the loaded file doesn't exist
140
+ $container->import('my_config_file.yaml', null, 'not_found');
141
+ // 'ignore_errors' set to true silently discards all errors (including invalid code and not found)
142
+ $container->import('my_config_file.yaml', null, true);
131
143
};
132
144
133
145
// ...
134
146
147
+ .. versionadded :: 4.4
148
+
149
+ The ``not_found `` option value for ``ignore_errors `` was introduced in Symfony 4.4.
150
+
135
151
.. _config-parameter-intro :
136
152
.. _config-parameters-yml :
137
153
.. _configuration-parameters :
0 commit comments