Skip to content
PHP Ecosystem
Explore

DbExplain

API reference › Yii3 Debug › Db › DbExplain

final readonly classYii3\Debug\Db\DbExplain
Sourcesrc/Db/DbExplain.php

Runs non-ANALYZE plans for captured single DML statements on an explicitly configured development connection.

MethodDescriptionDefined 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
public function __construct(Yiisoft\Db\Connection\ConnectionInterface|null $connection = null)

Creates a query-plan runner for the configured development connection.

Parameters

ParameterTypeDescription
$connectionYiisoft\Db\Connection\ConnectionInterface|nullDevelopment connection the plans run on, or null to disable the feature.
public function available(): bool

Returns 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.

public function render(PHPForge\Debug\Panel\Db\QueryRow $row): string

Runs the plan for one captured statement and renders it.

Parameters

ParameterTypeDescription
$rowPHPForge\Debug\Panel\Db\QueryRowCaptured statement to explain.

Returns

string: Rendered plan, or a rendered error when the statement cannot be explained.