@@ -16,6 +16,7 @@ class QueryCollector extends PDOCollector
16
16
protected $ timeCollector ;
17
17
protected $ queries = [];
18
18
protected $ queryCount = 0 ;
19
+ protected $ transactionEventsCount = 0 ;
19
20
protected $ softLimit = null ;
20
21
protected $ hardLimit = null ;
21
22
protected $ lastMemoryUsage ;
@@ -439,6 +440,7 @@ protected function getTwigInfo($trace)
439
440
*/
440
441
public function collectTransactionEvent ($ event , $ connection )
441
442
{
443
+ $ this ->transactionEventsCount ++;
442
444
$ source = [];
443
445
444
446
if ($ this ->findSource ) {
@@ -484,6 +486,11 @@ public function collect()
484
486
$ statements = [];
485
487
foreach ($ queries as $ query ) {
486
488
$ 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
+
487
494
$ totalTime += $ query ['time ' ];
488
495
$ totalMemory += $ query ['memory ' ];
489
496
@@ -497,11 +504,6 @@ public function collect()
497
504
default => false ,
498
505
};
499
506
500
- $ source = $ this ->getDataFormatter ()->formatSource ($ source );
501
- if (Str::startsWith ($ source , $ this ->excludePaths )) {
502
- continue ;
503
- }
504
-
505
507
$ statements [] = [
506
508
'sql ' => $ this ->getSqlQueryToDisplay ($ query ),
507
509
'type ' => $ query ['type ' ],
@@ -580,7 +582,7 @@ public function collect()
580
582
$ data = [
581
583
'nb_statements ' => $ this ->queryCount ,
582
584
'nb_visible_statements ' => count ($ statements ),
583
- 'nb_excluded_statements ' => $ this ->queryCount - count ($ statements ),
585
+ 'nb_excluded_statements ' => $ this ->queryCount + $ this -> transactionEventsCount - count ($ statements ),
584
586
'nb_failed_statements ' => 0 ,
585
587
'accumulated_duration ' => $ totalTime ,
586
588
'accumulated_duration_str ' => $ this ->formatDuration ($ totalTime ),
0 commit comments