Skip to content

Commit 6987db2

Browse files
neveldojaviereguiluz
authored andcommitted
Update configuration.rst
Fix PHP configuration sample for setting default parameter bindings.
1 parent 58ddc5f commit 6987db2

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

configuration.rst

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -881,18 +881,15 @@ whenever a service/controller defines a ``$projectDir`` argument, use this:
881881
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
882882
883883
use App\Controller\LuckyController;
884-
use Psr\Log\LoggerInterface;
885-
use Symfony\Component\DependencyInjection\Reference;
886884
887885
return static function (ContainerConfigurator $container) {
888-
$container->services()
889-
->set(LuckyController::class)
890-
->public()
891-
->args([
892-
// pass this value to any $projectDir argument for any service
893-
// that's created in this file (including controller arguments)
894-
'$projectDir' => '%kernel.project_dir%',
895-
]);
886+
$services = $container->services()
887+
->defaults()
888+
// pass this value to any $projectDir argument for any service
889+
// that's created in this file (including controller arguments)
890+
->bind('$projectDir', '%kernel.project_dir%');
891+
892+
// ...
896893
};
897894
898895
.. seealso::

0 commit comments

Comments
 (0)