DbQueryRenderer
API reference › Debug Core › Panel › Db › DbQueryRenderer
Renders the typed cells of the queries grid for the DB debug panel.
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
renderDurationCell() static | Renders the statement duration formatted as N.N ms. | DbQueryRenderer |
renderNPlusOneSummary() static | Renders an actionable summary linking each potential N+1 group to its first query. | DbQueryRenderer |
renderQueryCell() static | Renders the SQL statement column with its optional collapsed backtrace and EXPLAIN toggle. | DbQueryRenderer |
renderRowsCell() static | Renders the rows-affected cell, falling back to an en dash (–) when the driver did not report the count. | DbQueryRenderer |
renderTimeCell() static | Renders the capture time as H:i:s.mmm, derived from the row’s millisecond timestamp. | DbQueryRenderer |
renderTypeCell() static | Renders the statement-type pill (SELECT, INSERT, UPDATE, …), tinted by its vocabulary verb. | DbQueryRenderer |
Method details
Section titled “Method details”renderDurationCell()
Section titled “renderDurationCell() ”public static function renderDurationCell(PHPForge\Debug\Panel\Db\QueryRow $row): stringRenders the statement duration formatted as N.N ms.
renderNPlusOneSummary()
Section titled “renderNPlusOneSummary() ”public static function renderNPlusOneSummary(list<PHPForge\Debug\Panel\Db\NPlusOneFinding> $findings, string $context = ''): stringRenders an actionable summary linking each potential N+1 group to its first query.
Parameters
| Parameter | Type | Description |
|---|---|---|
$findings | list<NPlusOneFinding> | |
$context | string | Optional plain-text scope appended to the visible heading and accessible label. |
Returns
string
renderQueryCell()
Section titled “renderQueryCell() ”public static function renderQueryCell(PHPForge\Debug\Panel\Db\QueryRow $row, Closure(array<string, mixed>): string $traceLine, bool $hasExplain, callable(int): string $explainUrlBuilder, PHPForge\Debug\Panel\Db\NPlusOneFinding|null $nPlusOneFinding = null): stringRenders the SQL statement column with its optional collapsed backtrace and EXPLAIN toggle.
The caller supplies a URL builder so the renderer stays free of routing concerns and easy to test in isolation
(typically static fn(int $seq) => Url::to(['db-explain', 'seq' => $seq, ...])).
Parameters
| Parameter | Type | Description |
|---|---|---|
$row | QueryRow | Typed query record. |
$traceLine | Closure(array<string, | Renders one backtrace frame as a link line. |
$hasExplain | bool | true when the active driver supports EXPLAIN; the row must also be EXPLAIN-eligible. |
$explainUrlBuilder | callable(int): string | Builds the EXPLAIN URL for the given query sequence index. |
$nPlusOneFinding | NPlusOneFinding| |
Returns
string
renderRowsCell()
Section titled “renderRowsCell() ”public static function renderRowsCell(PHPForge\Debug\Panel\Db\QueryRow $row): stringRenders the rows-affected cell, falling back to an en dash (–) when the driver did not report the count.
renderTimeCell()
Section titled “renderTimeCell() ”public static function renderTimeCell(PHPForge\Debug\Panel\Db\QueryRow $row): stringRenders the capture time as H:i:s.mmm, derived from the row’s millisecond timestamp.
renderTypeCell()
Section titled “renderTypeCell() ”public static function renderTypeCell(PHPForge\Debug\Panel\Db\QueryRow $row): stringRenders the statement-type pill (SELECT, INSERT, UPDATE, …), tinted by its vocabulary verb.