Skip to content

Adds a new variable "origin" in the return value of method "label ()" #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed

Conversation

laupiFrpar
Copy link

Hello,

Adds a new variable "origin" in the return value of method "label ()" in order to customize the rendering of the tag "label" based on the properties of the field.

A very common example, the required fields on a form are marked with '*'. Currently, you must type the following code :

<?php echo $form ['name']->label('name *') ?>

And it should be required for each field manually. Which is tedious.
With the variable 'origin', we can customize the display automatically.

Example:

In the file "FrameworkBundle / Resources / view / Form / label.php:

<label for="<?php echo $id ?>"><?php echo $view['translator']->trans($ label)?><?php echo ($origin->isRequired()) ? '<span> * </span>' : '' ?></ label>

or

<label for="<?php echo $id ?>"<?php echo ($origin->isRequired())? 'Class = "required"':''?>"><?php echo $view['translator']->trans($label)?></ label>

Best regards

Pierre-Louis LAUNAY added 5 commits October 14, 2010 12:07
…views/Form/widget/textarea_field.php : Call to undefined method

Symfony\Bundle\FrameworkBundle\Templating\Form\Field::getDisplayedData()
… order customize the rendering of the tag "label" based on the properties of the field
jderusse pushed a commit to jderusse/symfony that referenced this pull request Mar 30, 2020
OskarStark pushed a commit to PGLongo/symfony that referenced this pull request Dec 22, 2020
# Das ist die erste Commit-Beschreibung:

[Notifier] add support for gatewayapi-notifier

# Die Commit-Beschreibung symfony#2 wird ausgelassen:

# Make GatewayAPITransportFactory final

# Die Commit-Beschreibung symfony#3 wird ausgelassen:

# Fix typo in gatewaypi

# Die Commit-Beschreibung symfony#4 wird ausgelassen:

# Fix typo

# Die Commit-Beschreibung symfony#5 wird ausgelassen:

# Update README.md

# Die Commit-Beschreibung symfony#6 wird ausgelassen:

# Rename GatewayAPI -> GatewayApi

# Die Commit-Beschreibung symfony#7 wird ausgelassen:

# Add GatewayApiTransportFactory tests

# Die Commit-Beschreibung symfony#8 wird ausgelassen:

# Add GatewayApiTransportTest testSend

# Die Commit-Beschreibung symfony#9 wird ausgelassen:

# Add GatewayApiTransportTest testSupportsSmsMessage

# Die Commit-Beschreibung symfony#10 wird ausgelassen:

# Add GatewayApiTransportTest testNotSupportsChatMessage

# Die Commit-Beschreibung symfony#11 wird ausgelassen:

# Lint code

# Die Commit-Beschreibung symfony#12 wird ausgelassen:

# Fix name and email in composer.json
#
# Co-authored-by: Tobias Nyholm <tobias.nyholm@gmail.com>

# Die Commit-Beschreibung symfony#13 wird ausgelassen:

# Remove extra from composer.json

# Die Commit-Beschreibung symfony#14 wird ausgelassen:

# Update version tag in GatewayApiTransport

# Die Commit-Beschreibung symfony#15 wird ausgelassen:

# Add /.gitattributes export-ignore in .gitattributes

# Die Commit-Beschreibung symfony#16 wird ausgelassen:

# Update UnsupportedSchemeException

# Die Commit-Beschreibung symfony#17 wird ausgelassen:

# Add required space in phpdoc

# Die Commit-Beschreibung symfony#18 wird ausgelassen:

# Update GatewayApiTransportFactory.php
#
# Update version tag in GatewayApiTransportFactory

# Die Commit-Beschreibung symfony#19 wird ausgelassen:

# [Notifier] add support for gatewayapi-notifier

# Die Commit-Beschreibung symfony#20 wird ausgelassen:

# Make GatewayAPITransportFactory final

# Die Commit-Beschreibung symfony#21 wird ausgelassen:

# Make GatewayAPITransportFactory final

# Die Commit-Beschreibung symfony#22 wird ausgelassen:

# Fix typo in gatewaypi

# Die Commit-Beschreibung symfony#23 wird ausgelassen:

# Fix typo

# Die Commit-Beschreibung symfony#24 wird ausgelassen:

# Update README.md
chalasr added a commit that referenced this pull request Mar 5, 2024
…lishing a message. (jwage)

This PR was squashed before being merged into the 6.4 branch.

Discussion
----------

[Messenger] [Amqp] Handle AMQPConnectionException when publishing a message.

| Q             | A
| ------------- | ---
| Branch?       | 6.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        | Fix #36538 Fix #48241
| License       | MIT

If you have a message handler that dispatches messages to another queue, you can encounter `AMQPConnectionException` with the message "Library error: a SSL error occurred" or "a socket error occurred"  depending on if you are using tls or not or if you are running behind a load balancer or not.

You can manually reproduce this issue by dispatching a message where the handler then dispatches another message to a different queue, then go to rabbitmq admin and close the connection manually, then dispatch another message and when the message handler goes to dispatch the other message, you will get this exception:

```
a socket error occurred
#0 /vagrant/vendor/symfony/amqp-messenger/Transport/AmqpTransport.php(60): Symfony\Component\Messenger\Bridge\Amqp\Transport\AmqpSender->send()
#1 /vagrant/vendor/symfony/messenger/Middleware/SendMessageMiddleware.php(62): Symfony\Component\Messenger\Bridge\Amqp\Transport\AmqpTransport->send()
#2 /vagrant/vendor/symfony/messenger/Middleware/FailedMessageProcessingMiddleware.php(34): Symfony\Component\Messenger\Middleware\SendMessageMiddleware->handle()
#3 /vagrant/vendor/symfony/messenger/Middleware/DispatchAfterCurrentBusMiddleware.php(61): Symfony\Component\Messenger\Middleware\FailedMessageProcessingMiddleware->handle()
#4 /vagrant/vendor/symfony/messenger/Middleware/RejectRedeliveredMessageMiddleware.php(41): Symfony\Component\Messenger\Middleware\DispatchAfterCurrentBusMiddleware->handle()
#5 /vagrant/vendor/symfony/messenger/Middleware/AddBusNameStampMiddleware.php(37): Symfony\Component\Messenger\Middleware\RejectRedeliveredMessageMiddleware->handle()
#6 /vagrant/vendor/symfony/messenger/Middleware/TraceableMiddleware.php(40): Symfony\Component\Messenger\Middleware\AddBusNameStampMiddleware->handle()
#7 /vagrant/vendor/symfony/messenger/MessageBus.php(70): Symfony\Component\Messenger\Middleware\TraceableMiddleware->handle()
#8 /vagrant/vendor/symfony/messenger/TraceableMessageBus.php(38): Symfony\Component\Messenger\MessageBus->dispatch()
#9 /vagrant/src/Messenger/MessageBus.php(37): Symfony\Component\Messenger\TraceableMessageBus->dispatch()
#10 /vagrant/vendor/symfony/mailer/Mailer.php(66): App\Messenger\MessageBus->dispatch()
#11 /vagrant/src/Mailer/Mailer.php(83): Symfony\Component\Mailer\Mailer->send()
#12 /vagrant/src/Mailer/Mailer.php(96): App\Mailer\Mailer->send()
#13 /vagrant/src/MessageHandler/Trading/StrategySubscriptionMessageHandler.php(118): App\Mailer\Mailer->sendEmail()
#14 /vagrant/src/MessageHandler/Trading/StrategySubscriptionMessageHandler.php(72): App\MessageHandler\Trading\StrategySubscriptionMessageHandler->handle()
#15 /vagrant/vendor/symfony/messenger/Middleware/HandleMessageMiddleware.php(152): App\MessageHandler\Trading\StrategySubscriptionMessageHandler->__invoke()
#16 /vagrant/vendor/symfony/messenger/Middleware/HandleMessageMiddleware.php(91): Symfony\Component\Messenger\Middleware\HandleMessageMiddleware->callHandler()
#17 /vagrant/vendor/symfony/messenger/Middleware/SendMessageMiddleware.php(71): Symfony\Component\Messenger\Middleware\HandleMessageMiddleware->handle()
#18 /vagrant/vendor/symfony/messenger/Middleware/FailedMessageProcessingMiddleware.php(34): Symfony\Component\Messenger\Middleware\SendMessageMiddleware->handle()
#19 /vagrant/vendor/symfony/messenger/Middleware/DispatchAfterCurrentBusMiddleware.php(68): Symfony\Component\Messenger\Middleware\FailedMessageProcessingMiddleware->handle()
#20 /vagrant/vendor/symfony/messenger/Middleware/RejectRedeliveredMessageMiddleware.php(41): Symfony\Component\Messenger\Middleware\DispatchAfterCurrentBusMiddleware->handle()
#21 /vagrant/vendor/symfony/messenger/Middleware/AddBusNameStampMiddleware.php(37): Symfony\Component\Messenger\Middleware\RejectRedeliveredMessageMiddleware->handle()
#22 /vagrant/vendor/symfony/messenger/Middleware/TraceableMiddleware.php(40): Symfony\Component\Messenger\Middleware\AddBusNameStampMiddleware->handle()
#23 /vagrant/vendor/symfony/messenger/MessageBus.php(70): Symfony\Component\Messenger\Middleware\TraceableMiddleware->handle()
#24 /vagrant/vendor/symfony/messenger/TraceableMessageBus.php(38): Symfony\Component\Messenger\MessageBus->dispatch()
#25 /vagrant/vendor/symfony/messenger/RoutableMessageBus.php(54): Symfony\Component\Messenger\TraceableMessageBus->dispatch()
#26 /vagrant/vendor/symfony/messenger/Worker.php(162): Symfony\Component\Messenger\RoutableMessageBus->dispatch()
#27 /vagrant/vendor/symfony/messenger/Worker.php(109): Symfony\Component\Messenger\Worker->handleMessage()
#28 /vagrant/vendor/symfony/messenger/Command/ConsumeMessagesCommand.php(238): Symfony\Component\Messenger\Worker->run()
#29 /vagrant/vendor/symfony/console/Command/Command.php(326): Symfony\Component\Messenger\Command\ConsumeMessagesCommand->execute()
#30 /vagrant/vendor/symfony/console/Application.php(1096): Symfony\Component\Console\Command\Command->run()
#31 /vagrant/vendor/symfony/framework-bundle/Console/Application.php(126): Symfony\Component\Console\Application->doRunCommand()
#32 /vagrant/vendor/symfony/console/Application.php(324): Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand()
#33 /vagrant/vendor/symfony/framework-bundle/Console/Application.php(80): Symfony\Component\Console\Application->doRun()
#34 /vagrant/vendor/symfony/console/Application.php(175): Symfony\Bundle\FrameworkBundle\Console\Application->doRun()
#35 /vagrant/vendor/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php(49): Symfony\Component\Console\Application->run()
#36 /vagrant/vendor/autoload_runtime.php(29): Symfony\Component\Runtime\Runner\Symfony\ConsoleApplicationRunner->run()
#37 /vagrant/bin/console(11): require_once('...')
#38 {main}
```

TODO:

- [x] Add test for retry logic when publishing messages

Commits
-------

f123370 [Messenger] [Amqp] Handle AMQPConnectionException when publishing a message.
stobrien89 pushed a commit to stobrien89/symfony that referenced this pull request Feb 27, 2025
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant