Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5dad871

Browse files
committed
bug #40595 add missing queue_name to find(id) in doctrine messenger transport (monteiro)
This PR was merged into the 4.4 branch. Discussion ---------- add missing queue_name to find(id) in doctrine messenger transport | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | License | MIT This bug was noticed by @weaverryan when reviewing the PR: #38468 related to multiple failure transports. Commits ------- bb26a92 add missing queue_name to find(id) in doctrine messenger transport
2 parents 09fe733 + bb26a92 commit 5dad871

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/Symfony/Component/Messenger/Tests/Transport/Doctrine/ConnectionTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ public function testFind()
284284
->willReturn($queryBuilder);
285285
$queryBuilder
286286
->method('where')
287+
->with('m.id = ? and m.queue_name = ?')
287288
->willReturn($queryBuilder);
288289
$queryBuilder
289290
->method('getSQL')

src/Symfony/Component/Messenger/Transport/Doctrine/Connection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,9 +291,9 @@ public function findAll(int $limit = null): array
291291
public function find($id): ?array
292292
{
293293
$queryBuilder = $this->createQueryBuilder()
294-
->where('m.id = ?');
294+
->where('m.id = ? and m.queue_name = ?');
295295

296-
$stmt = $this->executeQuery($queryBuilder->getSQL(), [$id]);
296+
$stmt = $this->executeQuery($queryBuilder->getSQL(), [$id, $this->configuration['queue_name']]);
297297
$data = $stmt instanceof Result || $stmt instanceof DriverResult ? $stmt->fetchAssociative() : $stmt->fetch();
298298

299299
return false === $data ? null : $this->decodeEnvelopeHeaders($data);

0 commit comments

Comments
 (0)