Skip to content

Commit a5b4ad1

Browse files
committed
minor #9676 Update compiler_passes.rst (DonCallisto)
This PR was submitted for the 4.0 branch but it was merged into the 3.4 branch instead (closes #9676). Discussion ---------- Update compiler_passes.rst I think that `findDefinition` is better than `getDefinition` as it will also look at aliases. I found this by myself while migrating from sf < 3.4 to sf >= 3.4. In particular I was following [this](https://symfony.com/doc/current/service_container/3.3-di-changes.html) and at point 2 services managed directly by `CompilerPass` were never founded. Moreover - not related directly to this PR - I'm not sure that this "split" `getDefinition`/`findDefinition`/`getAlias` is really useful, but maybe I don't have the bigger picture. WDYT? PS.: Maybe this edit could be applied not only for sf 4 but also for previous versions? Commits ------- 9b26fce Update compiler_passes.rst
2 parents 3641425 + 9b26fce commit a5b4ad1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

service_container/compiler_passes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ and process the services inside the ``process()`` method::
5656
{
5757
// in this method you can manipulate the service container:
5858
// for example, changing some container service:
59-
$container->getDefinition('app.some_private_service')->setPublic(true);
59+
$container->findDefinition('app.some_private_service')->setPublic(true);
6060

6161
// or processing tagged services:
6262
foreach ($container->findTaggedServiceIds('some_tag') as $id => $tags) {

0 commit comments

Comments
 (0)