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

Replace the fluent PHP config format by the array-shape one#21511

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

Open
nicolas-grekas wants to merge2 commits intosymfony:8.0
base:8.0
Choose a base branch
Loading
fromnicolas-grekas:php-array
Open
Show file tree
Hide file tree
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
27 changes: 16 additions & 11 deletionsbundles/configuration.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -23,11 +23,13 @@ as integration of other related components:
..code-block::php
// config/packages/framework.php
use Symfony\Config\FrameworkConfig;
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
return static function (FrameworkConfig $framework): void {
$framework->form()->enabled(true);
};
return App::config([
'framework' => [
'form' => true,
],
]);
There are two different ways of creating friendly configuration for a bundle:

Expand DownExpand Up@@ -148,13 +150,16 @@ can add some configuration that looks like this:
..code-block::php
// config/packages/acme_social.php
use Symfony\Config\AcmeSocialConfig;
return static function (AcmeSocialConfig $acmeSocial): void {
$acmeSocial->twitter()
->clientId(123)
->clientSecret('your_secret');
};
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
return App::config([
'acme_social' => [
'twitter' => [
'client_id' => 123,
'client_secret' => 'your_secret',
],
],
]);
The basic idea is that instead of having the user override individual
parameters, you let the user configure just a few, specifically created,
Expand Down
16 changes: 6 additions & 10 deletionsbundles/prepend_extension.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -100,30 +100,26 @@ registered and the ``entity_manager_name`` setting for ``acme_hello`` is set to

# config/packages/acme_something.yaml
acme_something:
# ...
use_acme_goodbye: false
entity_manager_name: non_default

acme_other:
# ...
use_acme_goodbye: false

.. code-block:: php

// config/packages/acme_something.php
namespace Symfony\Component\DependencyInjection\Loader\Configurator;

return static function (ContainerConfigurator $container): void {
$container->extension('acme_something', [
// ...
return App::config([
'acme_something' => [
'use_acme_goodbye' => false,
'entity_manager_name' => 'non_default',
]);
$container->extension('acme_other', [
// ...
],
'acme_other' => [
'use_acme_goodbye' => false,
]);
};
],
]);

Prepending Extension in the Bundle Class
----------------------------------------
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp