Skip to content
PHP Ecosystem
Explore

DbPanel

API reference › Yii3 Debug › Panel › DbPanel

final classYii3\Debug\Panel\DbPanel
ImplementsToolbarPanelProviderInterface
Sourcesrc/Panel/DbPanel.php

Presents the shared Database grid with Yii3 navigation, filters, page-scoped N+1 groups, and optional query plans.

MethodDescriptionDefined by
__construct()Creates the Database panel with query plans, debugger URLs, and source traces.DbPanel
criticalQueryThreshold()Returns the query count above which a request is critical, or 0 when the check is disabled.DbPanel
hasContent()Reports whether the capture recorded database statements worth opening the panel for.DbPanel
icon()Returns the icon key shared with the built-in Database navigation entry.DbPanel
id()Returns the identifier associating the panel with its slice of the captured payload.DbPanel
isQueryCountCritical()Returns whether the given query count exceeds the configured critical threshold.DbPanel
name()Returns the panel title shown in the debugger navigation.DbPanel
render()Renders the detail view, letting the page context drive filtering, sorting, and paging.DbPanel
toolbarItems()Builds the toolbar metric: the executed statement count, flagged when a threshold is exceeded.DbPanel
withThresholds()Returns a new instance with the thresholds that mark a capture as worth attention.DbPanel
public function __construct(Yii3\Debug\Db\DbExplain $explain, Yii3\Debug\Web\DebugUrlGenerator $urls, PHPForge\Debug\Helper\Trace $trace)

Creates the Database panel with query plans, debugger URLs, and source traces.

Parameters

ParameterTypeDescription
$explainYii3\Debug\Db\DbExplainQuery-plan runner of the development connection.
$urlsYii3\Debug\Web\DebugUrlGeneratorAdapter-owned URL generator backing the query-plan links.
$traceTraceConfigured renderer of the argument-free source frames shown beside each query.
public function criticalQueryThreshold(): int

Returns the query count above which a request is critical, or 0 when the check is disabled.

Returns

int: Threshold in statements; 0 when the check is disabled.

public function hasContent(array<string, mixed> $payload): bool

Reports whether the capture recorded database statements worth opening the panel for.

The capture is listed whenever it carries a payload; the detail page and the toolbar chip surface a malformed one when they hydrate it.

Parameters

ParameterTypeDescription
$payloadarray<string, mixed>Serialized panel payload.

Returns

bool: true when the capture carried data; false otherwise.

public function icon(): string

Returns the icon key shared with the built-in Database navigation entry.

Returns

string: Shared Debug Core icon key.

public function id(): string

Returns the identifier associating the panel with its slice of the captured payload.

Returns

string: Stable panel identifier.

public function isQueryCountCritical(int $count): bool

Returns whether the given query count exceeds the configured critical threshold.

Parameters

ParameterTypeDescription
$countintStatements executed during the captured request.

Returns

bool: true when the count exceeds the threshold; false otherwise.

public function name(): string

Returns the panel title shown in the debugger navigation.

Returns

string: Human-readable panel name.

public function render(Yii3\Debug\Panel\PanelRenderInput $input): string

Renders the detail view, letting the page context drive filtering, sorting, and paging.

Parameters

ParameterTypeDescription
$inputPanelRenderInputPayload, request context, and request summary of the page being rendered.

Returns

string: Rendered panel markup.

public function toolbarItems(array<string, mixed> $payload): list<PHPForge\Debug\Toolbar\ToolbarItem>

Builds the toolbar metric: the executed statement count, flagged when a threshold is exceeded.

Parameters

ParameterTypeDescription
$payloadarray<string, mixed>Serialized panel payload.

Returns

list<PHPForge\Debug\Toolbar\ToolbarItem>: Toolbar metrics, or an empty list when the capture executed no statement.

public function withThresholds(int|null $criticalQueryThreshold, int|null $excessiveCallerThreshold): self

Returns a new instance with the thresholds that mark a capture as worth attention.

Parameters

ParameterTypeDescription
$criticalQueryThresholdint|nullStatement count above which the capture is critical, or null to disable the check.
$excessiveCallerThresholdint|nullStatements per call site that flag it, or null to disable the check.

Returns

self: New instance carrying the requested thresholds.