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: https://github.com/symfony/symfony/pull/38468 related to multiple failure transports.

Commits
-------

bb26a92826 add missing queue_name to find(id) in doctrine messenger transport
This commit is contained in:
Robin Chalas 2021-03-30 00:15:30 +02:00
commit 5dad871833
2 changed files with 3 additions and 2 deletions

View File

@ -284,6 +284,7 @@ class ConnectionTest extends TestCase
->willReturn($queryBuilder);
$queryBuilder
->method('where')
->with('m.id = ? and m.queue_name = ?')
->willReturn($queryBuilder);
$queryBuilder
->method('getSQL')

View File

@ -291,9 +291,9 @@ class Connection
public function find($id): ?array
{
$queryBuilder = $this->createQueryBuilder()
->where('m.id = ?');
->where('m.id = ? and m.queue_name = ?');
$stmt = $this->executeQuery($queryBuilder->getSQL(), [$id]);
$stmt = $this->executeQuery($queryBuilder->getSQL(), [$id, $this->configuration['queue_name']]);
$data = $stmt instanceof Result || $stmt instanceof DriverResult ? $stmt->fetchAssociative() : $stmt->fetch();
return false === $data ? null : $this->decodeEnvelopeHeaders($data);