@@ -16,6 +16,7 @@ class QueryCollector extends PDOCollector
1616 protected $ timeCollector ;
1717 protected $ queries = [];
1818 protected $ queryCount = 0 ;
19+ protected $ transactionEventsCount = 0 ;
1920 protected $ softLimit = null ;
2021 protected $ hardLimit = null ;
2122 protected $ lastMemoryUsage ;
@@ -439,6 +440,7 @@ protected function getTwigInfo($trace)
439440 */
440441 public function collectTransactionEvent ($ event , $ connection )
441442 {
443+ $ this ->transactionEventsCount ++;
442444 $ source = [];
443445
444446 if ($ this ->findSource ) {
@@ -484,6 +486,11 @@ public function collect()
484486 $ statements = [];
485487 foreach ($ queries as $ query ) {
486488 $ source = reset ($ query ['source ' ]);
489+ $ normalizedPath = is_object ($ source ) ? $ this ->normalizeFilePath ($ source ->file ?: '' ) : '' ;
490+ if ($ query ['type ' ] != 'transaction ' && Str::startsWith ($ normalizedPath , $ this ->excludePaths )) {
491+ continue ;
492+ }
493+
487494 $ totalTime += $ query ['time ' ];
488495 $ totalMemory += $ query ['memory ' ];
489496
@@ -497,11 +504,6 @@ public function collect()
497504 default => false ,
498505 };
499506
500- $ source = $ this ->getDataFormatter ()->formatSource ($ source );
501- if (Str::startsWith ($ source , $ this ->excludePaths )) {
502- continue ;
503- }
504-
505507 $ statements [] = [
506508 'sql ' => $ this ->getSqlQueryToDisplay ($ query ),
507509 'type ' => $ query ['type ' ],
@@ -580,7 +582,7 @@ public function collect()
580582 $ data = [
581583 'nb_statements ' => $ this ->queryCount ,
582584 'nb_visible_statements ' => count ($ statements ),
583- 'nb_excluded_statements ' => $ this ->queryCount - count ($ statements ),
585+ 'nb_excluded_statements ' => $ this ->queryCount + $ this -> transactionEventsCount - count ($ statements ),
584586 'nb_failed_statements ' => 0 ,
585587 'accumulated_duration ' => $ totalTime ,
586588 'accumulated_duration_str ' => $ this ->formatDuration ($ totalTime ),
0 commit comments