DbExplain
API reference › Yii3 Debug › Db › DbExplain
Runs non-ANALYZE plans for captured single DML statements on an explicitly configured development connection.
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
__construct() | Creates a query-plan runner for the configured development connection. | DbExplain |
available() | Returns whether query plans can be produced for the configured connection. | DbExplain |
render() | Runs the plan for one captured statement and renders it. | DbExplain |
Method details
Section titled “Method details”__construct()
Section titled “__construct() ”public function __construct(Yiisoft\Db\Connection\ConnectionInterface|null $connection = null)Creates a query-plan runner for the configured development connection.
Parameters
| Parameter | Type | Description |
|---|---|---|
$connection | Yiisoft\ | Development connection the plans run on, or null to disable the feature. |
available()
Section titled “available() ”public function available(): boolReturns whether query plans can be produced for the configured connection.
Returns
bool: true when a connection is configured and its driver supports plans; false otherwise.
render()
Section titled “render() ”public function render(PHPForge\Debug\Panel\Db\QueryRow $row): stringRuns the plan for one captured statement and renders it.
Parameters
| Parameter | Type | Description |
|---|---|---|
$row | PHPForge\ | Captured statement to explain. |
Returns
string: Rendered plan, or a rendered error when the statement cannot be explained.