# DbPanel

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

[API reference](/docs/api/index.md) › [Yii3 Debug](/docs/extensions/yii3-debug/reference/index.md) › [Panel](/docs/extensions/yii3-debug/reference/panel/index.md) › DbPanel

| final class | `Yii3\Debug\Panel\DbPanel` |
| --- | --- |
| Implements | [`ToolbarPanelProviderInterface`](/docs/extensions/yii3-debug/reference/panel/toolbarpanelproviderinterface/index.md) |
| Source | [`src/Panel/DbPanel.php`](https://github.com/yii3/debug/blob/main/src/Panel/DbPanel.php#L37) |

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

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`__construct()`](#method-__construct) | Creates the Database panel with query plans, debugger URLs, and source traces. | `DbPanel` |
| [`criticalQueryThreshold()`](#method-criticalQueryThreshold) | Returns the query count above which a request is critical, or `0` when the check is disabled. | `DbPanel` |
| [`hasContent()`](#method-hasContent) | Reports whether the capture recorded database statements worth opening the panel for. | `DbPanel` |
| [`icon()`](#method-icon) | Returns the icon key shared with the built-in Database navigation entry. | `DbPanel` |
| [`id()`](#method-id) | Returns the identifier associating the panel with its slice of the captured payload. | `DbPanel` |
| [`isQueryCountCritical()`](#method-isQueryCountCritical) | Returns whether the given query count exceeds the configured critical threshold. | `DbPanel` |
| [`name()`](#method-name) | Returns the panel title shown in the debugger navigation. | `DbPanel` |
| [`render()`](#method-render) | Renders the detail view, letting the page context drive filtering, sorting, and paging. | `DbPanel` |
| [`toolbarItems()`](#method-toolbarItems) | Builds the toolbar metric: the executed statement count, flagged when a threshold is exceeded. | `DbPanel` |
| [`withThresholds()`](#method-withThresholds) | Returns a new instance with the thresholds that mark a capture as worth attention. | `DbPanel` |

## Method details

### __construct() <span id="method-__construct"></span>

```php
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\Debug\Db\DbExplain`](/docs/extensions/yii3-debug/reference/db/dbexplain/index.md) | Query-plan runner of the development connection. |
| `$urls` | [`Yii3\Debug\Web\DebugUrlGenerator`](/docs/extensions/yii3-debug/reference/web/debugurlgenerator/index.md) | Adapter-owned URL generator backing the query-plan links. |
| `$trace` | [`Trace`](https://github.com/php-forge/debug-core/blob/b70459f033a1d7a1c5edf7951029aad2061986dd/src/Helper/Trace.php) | Configured renderer of the argument-free source frames shown beside each query. |

### criticalQueryThreshold() <span id="method-criticalQueryThreshold"></span>

```php
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.

### hasContent() <span id="method-hasContent"></span>

```php
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**

| Parameter | Type | Description |
| --- | --- | --- |
| `$payload` | `array<string, mixed>` | Serialized panel payload. |

**Returns**

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

### icon() <span id="method-icon"></span>

```php
public function icon(): string
```

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

**Returns**

`string`: Shared Debug Core icon key.

### id() <span id="method-id"></span>

```php
public function id(): string
```

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

**Returns**

`string`: Stable panel identifier.

### isQueryCountCritical() <span id="method-isQueryCountCritical"></span>

```php
public function isQueryCountCritical(int $count): bool
```

Returns 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() <span id="method-name"></span>

```php
public function name(): string
```

Returns the panel title shown in the debugger navigation.

**Returns**

`string`: Human-readable panel name.

### render() <span id="method-render"></span>

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

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

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$input` | [`PanelRenderInput`](/docs/extensions/yii3-debug/reference/panel/panelrenderinput/index.md) | Payload, request context, and request summary of the page being rendered. |

**Returns**

`string`: Rendered panel markup.

### toolbarItems() <span id="method-toolbarItems"></span>

```php
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, mixed>` | Serialized panel payload. |

**Returns**

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

### withThresholds() <span id="method-withThresholds"></span>

```php
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**

| Parameter | Type | Description |
| --- | --- | --- |
| `$criticalQueryThreshold` | `int\|null` | Statement count above which the capture is critical, or `null` to disable the check. |
| `$excessiveCallerThreshold` | `int\|null` | Statements per call site that flag it, or `null` to disable the check. |

**Returns**

`self`: New instance carrying the requested thresholds.