Skip to content

Commit 92eb0d3

Browse files
authored
Update configuration.rst
Fix PHP configuration sample for setting default parameter bindings.
1 parent 04e46ae commit 92eb0d3

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
@@ -869,18 +869,15 @@ whenever a service/controller defines a ``$projectDir`` argument, use this:
869869
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
870870
871871
use App\Controller\LuckyController;
872-
use Psr\Log\LoggerInterface;
873-
use Symfony\Component\DependencyInjection\Reference;
874872
875873
return static function (ContainerConfigurator $container) {
876-
$container->services()
877-
->set(LuckyController::class)
878-
->public()
879-
->args([
880-
// pass this value to any $projectDir argument for any service
881-
// that's created in this file (including controller arguments)
882-
'$projectDir' => '%kernel.project_dir%',
883-
]);
874+
$services = $container->services()
875+
->defaults()
876+
// pass this value to any $projectDir argument for any service
877+
// that's created in this file (including controller arguments)
878+
->bind('$projectDir', '%kernel.project_dir%');
879+
880+
// ...
884881
};
885882
886883
.. seealso::

0 commit comments

Comments
 (0)