Skip to content

Commit 9139d80

Browse files
committed
feature #43588 [Messenger] Autoconfigurable attributes (alirezamirsepassi)
This PR was squashed before being merged into the 5.4 branch. Discussion ---------- [Messenger] Autoconfigurable attributes | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | Fix #41106 | License | MIT | Doc PR | symfony/symfony-docs#15990 Commits ------- f27e594bad [Messenger] Autoconfigurable attributes
2 parents 3ce0d40 + 58ecffb commit 9139d80

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

DependencyInjection/FrameworkExtension.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
use Symfony\Component\Mailer\Bridge\Sendinblue\Transport\SendinblueTransportFactory;
9898
use Symfony\Component\Mailer\Mailer;
9999
use Symfony\Component\Mercure\HubRegistry;
100+
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
100101
use Symfony\Component\Messenger\Bridge\AmazonSqs\Transport\AmazonSqsTransportFactory;
101102
use Symfony\Component\Messenger\Bridge\Amqp\Transport\AmqpTransportFactory;
102103
use Symfony\Component\Messenger\Bridge\Beanstalkd\Transport\BeanstalkdTransportFactory;
@@ -584,6 +585,13 @@ public function load(array $configs, ContainerBuilder $container)
584585
$container->registerAttributeForAutoconfiguration(AsController::class, static function (ChildDefinition $definition, AsController $attribute): void {
585586
$definition->addTag('controller.service_arguments');
586587
});
588+
$container->registerAttributeForAutoconfiguration(AsMessageHandler::class, static function (ChildDefinition $definition, AsMessageHandler $attribute): void {
589+
$tagAttributes = get_object_vars($attribute);
590+
$tagAttributes['from_transport'] = $tagAttributes['fromTransport'];
591+
unset($tagAttributes['fromTransport']);
592+
593+
$definition->addTag('messenger.message_handler', $tagAttributes);
594+
});
587595

588596
if (!$container->getParameter('kernel.debug')) {
589597
// remove tagged iterator argument for resource checkers

0 commit comments

Comments
 (0)