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

Commit8a7d32e

Browse files
committed
[#12697] Some minor tweaks
1 parentb7a35f2 commit8a7d32e

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

‎service_container/tags.rst‎

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -585,16 +585,15 @@ application handlers::
585585
}
586586
}
587587

588-
589588
Tagged Services with Priority
590589
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
591590

592591
..versionadded::4.4
593592

594593
The ability to prioritize tagged services was introduced in Symfony 4.4.
595594

596-
The tagged services can be prioritized using the ``priority`` attribute, thus providing
597-
a way to inject a sorted collection.
595+
The tagged services can be prioritized using the ``priority`` attribute,
596+
thus providinga way to inject a sorted collection of services:
598597

599598
..configuration-block::
600599

@@ -627,23 +626,21 @@ a way to inject a sorted collection.
627626
// config/services.php
628627
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
629628
629+
use App\Handler\One;
630+
630631
return function(ContainerConfigurator $configurator) {
631632
$services = $configurator->services();
632633
633-
$services->set(App\Handler\One::class)
634+
$services->set(One::class)
634635
->tag('app.handler', ['priority' => 20])
635636
;
636637
};
637638
638-
..note::
639-
640-
Note that any other custom attribute will be ignored by this feature.
641-
642-
643-
Another option, which is particularly useful when using autoconfiguring tags, is to implement the
644-
static ``getDefaultPriority`` method on the service itself::
639+
Another option, which is particularly useful when using autoconfiguring
640+
tags, is to implement the static ``getDefaultPriority()`` method on the
641+
service itself::
645642

646-
// src/App/Handler/One.php
643+
// src/Handler/One.php
647644
namespace App/Handler;
648645

649646
class One
@@ -654,7 +651,8 @@ static ``getDefaultPriority`` method on the service itself::
654651
}
655652
}
656653

657-
If you want to have another method defining the priority, you can define it in the configuration of the collecting service:
654+
If you want to have another method defining the priority, you can define it
655+
in the configuration of the collecting service:
658656

659657
..configuration-block::
660658

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp