diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index 99fe0de88f..d8f4b61699 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -1496,6 +1496,10 @@ class FrameworkExtension extends Extension $messageToSenderIdsMapping = array(); foreach ($config['routing'] as $message => $messageConfiguration) { + if (!class_exists($message) && !interface_exists($message, false)) { + throw new LogicException(sprintf('Messenger routing configuration contains a mistake: message "%s" does not exist. It needs to match an existing class or interface.', $message)); + } + $messageToSenderIdsMapping[$message] = $messageConfiguration['senders']; } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/messenger.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/messenger.php index 03cf020f04..16b311f5cd 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/messenger.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/messenger.php @@ -1,10 +1,13 @@ loadFromExtension('framework', array( 'messenger' => array( 'routing' => array( - 'App\Bar' => array('sender.bar', 'sender.biz'), - 'App\Foo' => 'sender.foo', + FooMessage::class => array('sender.bar', 'sender.biz'), + BarMessage::class => 'sender.foo', ), ), )); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/messenger.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/messenger.xml index 1ecdc09bfb..0a130ce0ba 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/messenger.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/messenger.xml @@ -7,11 +7,11 @@ - + - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/messenger.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/messenger.yml index 4f921514c4..7f038af11f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/messenger.yml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/messenger.yml @@ -1,5 +1,5 @@ framework: messenger: routing: - 'App\Bar': ['sender.bar', 'sender.biz'] - 'App\Foo': 'sender.foo' + 'Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Messenger\FooMessage': ['sender.bar', 'sender.biz'] + 'Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Messenger\BarMessage': 'sender.foo' diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Messenger/BarMessage.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Messenger/BarMessage.php new file mode 100644 index 0000000000..e6093351d5 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Messenger/BarMessage.php @@ -0,0 +1,7 @@ +