Skip to content

Commit c741bd6

Browse files
soyukaclaude
andcommitted
fix(tests): add missing RPC messenger handler for Symfony 8.1 compatibility
Symfony 8.1 Messenger strictly enforces `allow_no_handlers: false` (the default), throwing NoHandlerForMessageException when dispatching a message with no handler. The RPC entity uses `messenger: true` but had no handler registered. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 429b5c3 commit c741bd6

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the API Platform project.
5+
*
6+
* (c) Kévin Dunglas <dunglas@gmail.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
declare(strict_types=1);
13+
14+
namespace ApiPlatform\Tests\Fixtures\TestBundle\MessengerHandler\Entity;
15+
16+
use ApiPlatform\Tests\Fixtures\TestBundle\Entity\RPC;
17+
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
18+
19+
#[AsMessageHandler]
20+
class RPCHandler
21+
{
22+
public function __invoke(RPC $data): void
23+
{
24+
}
25+
}

tests/Fixtures/app/config/config_common.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,11 @@ services:
371371
tags:
372372
- name: 'messenger.message_handler'
373373

374+
app.messenger_handler.rpc:
375+
class: 'ApiPlatform\Tests\Fixtures\TestBundle\MessengerHandler\Entity\RPCHandler'
376+
tags:
377+
- name: 'messenger.message_handler'
378+
374379
ApiPlatform\Tests\Fixtures\TestBundle\Metadata\ProviderResourceMetadatatCollectionFactory:
375380
class: 'ApiPlatform\Tests\Fixtures\TestBundle\Metadata\ProviderResourceMetadatatCollectionFactory'
376381
decorates: api_platform.metadata.resource.metadata_collection_factory

0 commit comments

Comments
 (0)