Skip to content

Commit 8bacb1d

Browse files
ViktorTkachenkomrVrAlex
authored andcommitted
Add context check after reopen
1 parent ff2c3c8 commit 8bacb1d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/EntityManager.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,11 @@ public function getWrappedEm() : EntityManagerInterface
3535
$context[self::class] = ($this->emCreatorFn)();
3636
/** @psalm-suppress MixedMethodCall */
3737
Co::defer(static function () use ($context) {
38-
$context[self::class]->close();
39-
unset($context[self::class]);
38+
// After reopen context missing
39+
if (isset($context[self::class]) && $context[self::class] instanceof EntityManagerInterface) {
40+
$context[self::class]->close();
41+
unset($context[self::class]);
42+
}
4043
});
4144
}
4245
/** @psalm-var EntityManagerInterface */

0 commit comments

Comments
 (0)