We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1e1fe10 commit 28f7227Copy full SHA for 28f7227
1 file changed
src/Middleware.php
@@ -272,10 +272,12 @@ protected function checkTpUncommittedTransaction(): string
272
$instances = $property->getValue($manager_instance);
273
foreach ($instances as $connection) {
274
/* @var \think\db\connector\Mysql $connection */
275
- $pdo = $connection->getPdo();
276
- if ($pdo && $pdo->inTransaction()) {
277
- $connection->rollBack();
278
- $logs .= "[ERROR]\tUncommitted transaction found and try to rollback" . PHP_EOL;
+ if (method_exists($connection, 'getPdo')) {
+ $pdo = $connection->getPdo();
+ if ($pdo && $pdo->inTransaction()) {
+ $connection->rollBack();
279
+ $logs .= "[ERROR]\tUncommitted transaction found and try to rollback" . PHP_EOL;
280
+ }
281
}
282
283
} catch (Throwable $e) {
0 commit comments