Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5770d74

Browse files
committed
[Messenger] Backport a fix realted to query buses
1 parent 9b75dfa commit 5770d74

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

messenger.rst

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2271,9 +2271,11 @@ handler is registered. The ``HandleTrait`` can be used in any class that has a
22712271
{
22722272
use HandleTrait;
22732273

2274-
public function __construct(
2275-
private MessageBusInterface $messageBus,
2276-
) {
2274+
// the parameter must be named $queryBus to trigger autowiring of the 'query.bus' service
2275+
public function __construct(MessageBusInterface $queryBus)
2276+
{
2277+
// HandleTrait requires a property named $messageBus
2278+
$this->messageBus = $queryBus;
22772279
}
22782280

22792281
public function __invoke(): void
@@ -2306,9 +2308,11 @@ wherever you need a query bus behavior instead of the ``MessageBusInterface``::
23062308
{
23072309
use HandleTrait;
23082310

2309-
public function __construct(
2310-
private MessageBusInterface $messageBus,
2311-
) {
2311+
// the parameter must be named $queryBus to trigger autowiring of the 'query.bus' service
2312+
public function __construct(MessageBusInterface $queryBus)
2313+
{
2314+
// HandleTrait requires a property named $messageBus
2315+
$this->messageBus = $queryBus;
23122316
}
23132317

23142318
/**

0 commit comments

Comments
 (0)