Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8c03f5f

Browse filesBrowse files
committed
Throws UnrecoverableMessageHandlingException when passed invalid entity manager name for Doctrine middlewares
1 parent b319168 commit 8c03f5f
Copy full SHA for 8c03f5f

File tree

2 files changed

+3
-4
lines changed
Filter options

2 files changed

+3
-4
lines changed

‎src/Symfony/Bridge/Doctrine/Messenger/DoctrineClearEntityManagerMiddleware.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Messenger/DoctrineClearEntityManagerMiddleware.php
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Bridge\Doctrine\Messenger;
1313

1414
use Doctrine\Common\Persistence\ManagerRegistry;
15-
use Doctrine\ORM\EntityManagerInterface;
1615
use Symfony\Component\Messenger\Envelope;
1716
use Symfony\Component\Messenger\Exception\UnrecoverableMessageHandlingException;
1817
use Symfony\Component\Messenger\Middleware\MiddlewareInterface;
@@ -44,7 +43,7 @@ public function handle(Envelope $envelope, StackInterface $stack): Envelope
4443
try {
4544
$entityManager = $this->managerRegistry->getManager($this->entityManagerName);
4645
} catch (\InvalidArgumentException $e) {
47-
throw new UnrecoverableMessageHandlingException(sprintf('The ObjectManager with name "%s" must be an instance of EntityManagerInterface', $this->entityManagerName), 0, $e);
46+
throw new UnrecoverableMessageHandlingException($e->getMessage(), 0, $e);
4847
}
4948

5049
try {

‎src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrineClearEntityManagerMiddlewareTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrineClearEntityManagerMiddlewareTest.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ public function testInvalidEntityManagerThrowsException()
5959

6060
$middleware = new DoctrineClearEntityManagerMiddleware($managerRegistry, 'unknown_manager');
6161

62-
$this->expectsException(UnrecoverableMessageHandlingException::class);
62+
$this->expectException(UnrecoverableMessageHandlingException::class);
6363

64-
$middleware->handle(new Envelope(new \stdClass()), $this->getStackMock());
64+
$middleware->handle(new Envelope(new \stdClass()), $this->getStackMock(false));
6565
}
6666
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.