Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/middlewares.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
->args([
service('doctrine.debug_data_holder'),
service('debug.stopwatch')->nullOnInvalid(),
service('doctrine'),
])

->set('doctrine.dbal.idle_connection_middleware', IdleConnectionMiddleware::class)
Expand Down
4 changes: 3 additions & 1 deletion src/Middleware/DebugMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Doctrine\DBAL\Driver as DriverInterface;
use Doctrine\DBAL\Driver\Middleware;
use Doctrine\Persistence\ConnectionRegistry;
use Symfony\Bridge\Doctrine\Middleware\Debug\DebugDataHolder;
use Symfony\Bridge\Doctrine\Middleware\Debug\Driver;
use Symfony\Component\Stopwatch\Stopwatch;
Expand All @@ -17,6 +18,7 @@ class DebugMiddleware implements Middleware, ConnectionNameAwareInterface
public function __construct(
private readonly DebugDataHolder $debugDataHolder,
private readonly Stopwatch|null $stopwatch,
private readonly ConnectionRegistry|null $connectionRegistry = null,
) {
}

Expand All @@ -27,6 +29,6 @@ public function setConnectionName(string $name): void

public function wrap(DriverInterface $driver): DriverInterface
{
return new Driver($driver, $this->debugDataHolder, $this->stopwatch, $this->connectionName);
return new Driver($driver, $this->debugDataHolder, $this->stopwatch, $this->connectionName, $this->connectionRegistry);
}
}
8 changes: 7 additions & 1 deletion templates/Collector/db.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,13 @@
<td class="nowrap">{{ query.count }}</td>
{% else %}
<td class="nowrap">{{ loop.index }}</td>
<td class="nowrap">{{ '%0.2f'|format(query.executionMS * 1000) }}&nbsp;ms</td>
<td>
<span class="nowrap">{{ '%0.2f'|format(query.executionMS * 1000) }}&nbsp;ms</span>
{% if query.ranOnPrimary is defined and query.ranOnPrimary is not null %}
<br />
<span class="badge">{{ query.ranOnPrimary ? 'Primary' : 'Replica' }}</span>
{% endif %}
</td>
{% endif %}
<td>
{{ query.sql|doctrine_prettify_sql }}
Expand Down
Loading