DbPanel
API reference › Yii3 Debug › Panel › DbPanel
Presents the shared Database grid with Yii3 navigation, filters, page-scoped N+1 groups, and optional query plans.
Methods
Section titled “Methods”| Method | Description | Defined 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 |
Method details
Section titled “Method details”__construct()
Section titled “__construct() ”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
| Parameter | Type | Description |
|---|---|---|
$explain | Yii3\ | Query-plan runner of the development connection. |
$urls | Yii3\ | Adapter-owned URL generator backing the query-plan links. |
$trace | Trace | Configured renderer of the argument-free source frames shown beside each query. |
criticalQueryThreshold()
Section titled “criticalQueryThreshold() ”public function criticalQueryThreshold(): intReturns 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.
hasContent()
Section titled “hasContent() ”public function hasContent(array<string, mixed> $payload): boolReports 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
| Parameter | Type | Description |
|---|---|---|
$payload | array<string, | Serialized panel payload. |
Returns
bool: true when the capture carried data; false otherwise.
icon()
Section titled “icon() ”public function icon(): stringReturns the icon key shared with the built-in Database navigation entry.
Returns
string: Shared Debug Core icon key.
public function id(): stringReturns the identifier associating the panel with its slice of the captured payload.
Returns
string: Stable panel identifier.
isQueryCountCritical()
Section titled “isQueryCountCritical() ”public function isQueryCountCritical(int $count): boolReturns whether the given query count exceeds the configured critical threshold.
Parameters
| Parameter | Type | Description |
|---|---|---|
$count | int | Statements executed during the captured request. |
Returns
bool: true when the count exceeds the threshold; false otherwise.
name()
Section titled “name() ”public function name(): stringReturns the panel title shown in the debugger navigation.
Returns
string: Human-readable panel name.
render()
Section titled “render() ”public function render(Yii3\Debug\Panel\PanelRenderInput $input): stringRenders the detail view, letting the page context drive filtering, sorting, and paging.
Parameters
| Parameter | Type | Description |
|---|---|---|
$input | PanelRenderInput | Payload, request context, and request summary of the page being rendered. |
Returns
string: Rendered panel markup.
toolbarItems()
Section titled “toolbarItems() ”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
| Parameter | Type | Description |
|---|---|---|
$payload | array<string, | Serialized panel payload. |
Returns
list<PHPForge\Debug\Toolbar\ToolbarItem>: Toolbar metrics, or an empty list when the capture executed no statement.
withThresholds()
Section titled “withThresholds() ”public function withThresholds(int|null $criticalQueryThreshold, int|null $excessiveCallerThreshold): selfReturns a new instance with the thresholds that mark a capture as worth attention.
Parameters
| Parameter | Type | Description |
|---|---|---|
$criticalQueryThreshold | int| | Statement count above which the capture is critical, or null to disable the check. |
$excessiveCallerThreshold | int| | Statements per call site that flag it, or null to disable the check. |
Returns
self: New instance carrying the requested thresholds.