Skip to content

Commit

Permalink
Merge pull request #1549 from ConductionNL/feature/XZ-163/couple-async
Browse files Browse the repository at this point in the history
Add new message to the messenger, render stringValue if objectValue has not been set yet
  • Loading branch information
rjzondervan authored Sep 15, 2023
2 parents d94a549 + ca7baeb commit 7f93648
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 1 deletion.
1 change: 0 additions & 1 deletion api/config/packages/messenger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,3 @@ framework:
'App\Message\ActionMessage': async
'App\Message\NotificationMessage': async
'App\Message\SyncPageMessage': async
'CommonGateway\CoreBundle\Message\CacheMessage': async
33 changes: 33 additions & 0 deletions api/config/packages/prod/messenger.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
parameters:
env(MESSENGER_TRANSPORT_DSN): "amqp://%env(RABBITMQ_USERNAME)%:%env(RABBITMQ_PASSWORD)%@%env(RABBITMQ_HOST)%:%env(RABBITMQ_PORT)%/%2f/messages"

framework:
messenger:
# Uncomment this (and the failed transport below) to send failed messages to this transport for later handling.
failure_transport: failed

transports:
# https://symfony.com/doc/current/messenger.html#transport-configuration
async:
dsn: '%env(MESSENGER_TRANSPORT_DSN)%'

retry_strategy:
max_retries: 5
delay: 5000
multiplier: 2
max_delay: 300000
failed: 'doctrine://default'
buses:
messenger.bus.default:
middleware:
- router_context



routing:
# Route your messages to the transports
'App\Message\ActionMessage': async
'App\Message\NotificationMessage': async
'App\Message\SyncPageMessage': async
'CommonGateway\CoreBundle\Message\CacheMessage': async
'CommonGateway\CoreBundle\Message\ValueMessage': async
5 changes: 5 additions & 0 deletions api/src/Entity/ObjectEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -1162,6 +1162,11 @@ public function toArray(array $configuration = []): array
$array[$attribute->getName()] = "Attribute {$attribute->getId()->toString()} of type 'object' has not Entity connected through Attribute->object";
} elseif ($valueObject->getValue() == null) {
$array[$attribute->getName()] = null;
if($valueObject->getStringValue() !== null) {
$array[$attribute->getName()] = $valueObject->getStringValue();
} elseif($valueObject->getArrayValue() !== []) {
$array[$attribute->getName()] = $valueObject->getArrayValue();
}
} elseif (!$attribute->getMultiple()) {
if (count($valueObject->getObjects()) === 0) {
$array[$attribute->getName()][] = null;
Expand Down

0 comments on commit 7f93648

Please sign in to comment.