Skip to content
Open
Show file tree
Hide file tree
Changes from all 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 deletions bundles/configuration.rst
Original file line number Diff line number Diff 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 Down Expand 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 deletions bundles/prepend_extension.rst
Original file line number Diff line number Diff 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