@@ -141,7 +141,7 @@ when importing it from any other configuration file:
141141
142142 # config/services.yaml
143143 imports :
144- - { resource: '/etc/sites/mysite.com/parameters.yaml', ignore_errors : true }
144+ - { resource: '/etc/sites/mysite.com/parameters.yaml', ignore_not_found : true }
145145
146146 # ...
147147
@@ -157,7 +157,7 @@ when importing it from any other configuration file:
157157 https://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
158158
159159 <imports >
160- <import resource =" /etc/sites/mysite.com/parameters.yaml" ignore-errors =" true" />
160+ <import resource =" /etc/sites/mysite.com/parameters.yaml" ignore-not-found =" true" />
161161 </imports >
162162
163163 <!-- ... -->
@@ -166,17 +166,63 @@ when importing it from any other configuration file:
166166 .. code-block :: php
167167
168168 // config/services.php
169- $loader->import('/etc/sites/mysite.com/parameters.yaml', null, true);
169+ use Symfony\Component\Config\Loader\FileLoader;
170+
171+ $loader->import('/etc/sites/mysite.com/parameters.yaml', null, FileLoader::IGNORE_FILE_NOT_FOUND);
170172
171173 // ...
172174
175+ .. versionadded :: 4.4
176+
177+ The ``ignore_not_found `` option was introduced in Symfony 4.4.
178+
173179.. tip ::
174180
175- The ``ignore_errors `` option (which is the third optional argument in the
181+ The ``ignore_not_found `` option (which is the third optional argument in the
176182 loader's ``import() `` method) silently discards errors when the loaded file
177183 doesn't exist. This is needed in this case because most of the time, local
178184 developers won't have the same files that exist on the production servers.
179185
186+ The older ``ignore_errors `` option silently discards all errors when the loaded file
187+ doesn't exist or contains invalid code.
188+
189+ .. configuration-block ::
190+
191+ .. code-block :: yaml
192+
193+ # config/services.yaml
194+ imports :
195+ - { resource: '/etc/sites/mysite.com/parameters.yaml', ignore_errors: true }
196+
197+ # ...
198+
199+ .. code-block :: xml
200+
201+ <!-- config/services.xml -->
202+ <?xml version =" 1.0" encoding =" UTF-8" ?>
203+ <container xmlns =" http://symfony.com/schema/dic/services"
204+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
205+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
206+ https://symfony.com/schema/dic/services/services-1.0.xsd
207+ http://symfony.com/schema/dic/symfony
208+ https://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
209+
210+ <imports >
211+ <import resource =" /etc/sites/mysite.com/parameters.yaml" ignore-errors =" true" />
212+ </imports >
213+
214+ <!-- ... -->
215+ </container >
216+
217+ .. code-block :: php
218+
219+ // config/services.php
220+ use Symfony\Component\Config\Loader\FileLoader;
221+
222+ $loader->import('/etc/sites/mysite.com/parameters.yaml', null, FileLoader::IGNORE_ALL);
223+
224+ // ...
225+
180226 As you've seen, there are lots of ways to organize your configuration files. You
181227can choose one of these or even create your own custom way of organizing the
182228files. For even more customization, see ":doc: `/configuration/override_dir_structure `".
0 commit comments