Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[DependencyInjection] Added optionignore_errors: not_found for imported config files#11647

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Merged
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 22 additions & 6 deletionsconfiguration.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -88,11 +88,15 @@ configuration files, even if they use a different format:
# config/services.yaml
imports:
- { resource: 'legacy_config.php' }
# ignore_errors silently discards errors if the loaded file doesn't exist
- { resource: 'my_config_file.xml', ignore_errors: true }

# glob expressions are also supported to load multiple files
- { resource: '/etc/myapp/*.yaml' }

# ignore_errors: not_found silently discards errors if the loaded file doesn't exist
- { resource: 'my_config_file.xml', ignore_errors: not_found }
# ignore_errors: true silently discards all errors (including invalid code and not found)
- { resource: 'my_other_config_file.xml', ignore_errors: true }

# ...

.. code-block:: xml
Expand All@@ -108,10 +112,13 @@ configuration files, even if they use a different format:

<imports>
<import resource="legacy_config.php"/>
<!-- ignore_errors silently discards errors if the loaded file doesn't exist -->
<import resource="my_config_file.yaml" ignore-errors="true"/>
<!-- glob expressions are also supported to load multiple files -->
<import resource="/etc/myapp/*.yaml"/>

<!-- ignore-errors="not_found" silently discards errors if the loaded file doesn't exist -->
<import resource="my_config_file.yaml" ignore-errors="not_found"/>
<!-- ignore-errors="true" silently discards all errors (including invalid code and not found) -->
<import resource="my_other_config_file.yaml" ignore-errors="true"/>
</imports>

<!-- ... -->
Expand All@@ -124,14 +131,23 @@ configuration files, even if they use a different format:

return static function (ContainerConfigurator $container) {
$container->import('legacy_config.php');
// ignore_errors (3rd parameter) silently discards errors if the loaded file doesn't exist
$container->import('my_config_file.xml', null, true);

// glob expressions are also supported to load multiple files
$container->import('/etc/myapp/*.yaml');

// the third optional argument of import() is 'ignore_errors'
// 'ignore_errors' set to 'not_found' silently discards errors if the loaded file doesn't exist
$container->import('my_config_file.yaml', null, 'not_found');
// 'ignore_errors' set to true silently discards all errors (including invalid code and not found)
$container->import('my_config_file.yaml', null, true);
};

// ...

.. versionadded:: 4.4

The ``not_found`` option value for ``ignore_errors`` was introduced in Symfony 4.4.

.. _config-parameter-intro:
.. _config-parameters-yml:
.. _configuration-parameters:
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp