@@ -196,7 +196,7 @@ public function addQuery($query)
196
196
'time ' => $ time ,
197
197
'memory ' => $ this ->lastMemoryUsage ? memory_get_usage (false ) - $ this ->lastMemoryUsage : 0 ,
198
198
'source ' => $ source ,
199
- 'connection ' => $ query ->connection -> getName () ,
199
+ 'connection ' => $ query ->connection ,
200
200
'driver ' => $ query ->connection ->getConfig ('driver ' ),
201
201
'hints ' => ($ this ->showHints && !$ limited ) ? $ hints : null ,
202
202
'show_copy ' => $ this ->showCopyButton ,
@@ -459,7 +459,7 @@ public function collectTransactionEvent($event, $connection)
459
459
'time ' => 0 ,
460
460
'memory ' => 0 ,
461
461
'source ' => $ source ,
462
- 'connection ' => $ connection-> getName () ,
462
+ 'connection ' => $ connection ,
463
463
'driver ' => $ connection ->getConfig ('driver ' ),
464
464
'hints ' => null ,
465
465
'show_copy ' => false ,
@@ -496,7 +496,7 @@ public function collect()
496
496
$ totalTime += $ query ['time ' ];
497
497
$ totalMemory += $ query ['memory ' ];
498
498
499
- $ connectionName = DB :: connection ( $ query ['connection ' ]) ->getDatabaseName ();
499
+ $ connectionName = $ query ['connection ' ]->getDatabaseName ();
500
500
if (str_ends_with ($ connectionName , '.sqlite ' )) {
501
501
$ connectionName = $ this ->normalizeFilePath ($ connectionName );
502
502
}
@@ -526,9 +526,9 @@ public function collect()
526
526
'explain ' => $ this ->explainQuery && $ canExplainQuery ? [
527
527
'url ' => route ('debugbar.queries.explain ' ),
528
528
'driver ' => $ query ['driver ' ],
529
- 'connection ' => $ query ['connection ' ],
529
+ 'connection ' => $ query ['connection ' ]-> getName () ,
530
530
'query ' => $ query ['query ' ],
531
- 'hash ' => (new Explain ())->hash ($ query ['connection ' ], $ query ['query ' ], $ query ['bindings ' ]),
531
+ 'hash ' => (new Explain ())->hash ($ query ['connection ' ]-> getName () , $ query ['query ' ], $ query ['bindings ' ]),
532
532
] : null ,
533
533
];
534
534
}
@@ -630,9 +630,9 @@ public function getWidgets()
630
630
private function getSqlQueryToDisplay (array $ query ): string
631
631
{
632
632
$ sql = $ query ['query ' ];
633
- if ($ query ['type ' ] === 'query ' && $ this ->renderSqlWithParams && DB :: connection ( $ query ['connection ' ]) ->getQueryGrammar () instanceof \Illuminate \Database \Query \Grammars \Grammar && method_exists (DB :: connection ( $ query ['connection ' ]) ->getQueryGrammar (), 'substituteBindingsIntoRawSql ' )) {
633
+ if ($ query ['type ' ] === 'query ' && $ this ->renderSqlWithParams && $ query ['connection ' ]->getQueryGrammar () instanceof \Illuminate \Database \Query \Grammars \Grammar && method_exists ($ query ['connection ' ]->getQueryGrammar (), 'substituteBindingsIntoRawSql ' )) {
634
634
try {
635
- $ sql = DB :: connection ( $ query ['connection ' ]) ->getQueryGrammar ()->substituteBindingsIntoRawSql ($ sql , $ query ['bindings ' ] ?? []);
635
+ $ sql = $ query ['connection ' ]->getQueryGrammar ()->substituteBindingsIntoRawSql ($ sql , $ query ['bindings ' ] ?? []);
636
636
return $ this ->getDataFormatter ()->formatSql ($ sql );
637
637
} catch (\Throwable $ e ) {
638
638
// Continue using the old substitute
0 commit comments