PHP Class yii\debug\panels\DbPanel

Since: 2.0
Author: Qiang Xue ([email protected])
Inheritance: extends yii\debug\Panel
Datei anzeigen Open project: yiisoft/yii2-debug Class Usage Examples

Public Properties

Property Type Description
$criticalQueryThreshold the threshold for determining whether the request has involved critical number of DB queries. If the number of queries exceeds this number, the execution is considered taking critical number of DB queries.
$db the name of the database component to use for executing (explain) queries
$defaultFilter the default filter to apply to the database queries. In the format of [ property => value ], for example: [ 'type' => 'SELECT' ]
$defaultOrder the default ordering of the database queries. In the format of [ property => sort direction ], for example: [ 'duration' => SORT_DESC ]

Public Methods

Method Description
calculateTimings ( ) : array Calculates given request profile timings.
canBeExplained ( string $type ) : boolean Check if given query type can be explained.
getDb ( ) : Connection Returns a reference to the DB component associated with the panel
getDetail ( )
getName ( )
getProfileLogs ( ) : array Returns all profile logs of the current request for this panel. It includes categories such as: 'yii\db\Command::query', 'yii\db\Command::execute'.
getSummary ( )
getSummaryName ( ) : string
getTypes ( ) : array Returns array query types
init ( )
isQueryCountCritical ( integer $count ) : boolean Check if given queries count is critical according settings.
save ( )

Protected Methods

Method Description
getModels ( ) : array Returns an array of models that represents logs of the current request.
getQueryType ( string $timing ) : string Returns database query type.
getTotalQueryTime ( array $timings ) : integer Returns total query time.
hasExplain ( ) : boolean

Method Details

calculateTimings() public method

Calculates given request profile timings.
public calculateTimings ( ) : array
return array timings [token, category, timestamp, traces, nesting level, elapsed time]

canBeExplained() public static method

Check if given query type can be explained.
Since: 2.0.5
public static canBeExplained ( string $type ) : boolean
$type string query type
return boolean

getDb() public method

Returns a reference to the DB component associated with the panel
Since: 2.0.5
public getDb ( ) : Connection
return yii\db\Connection

getDetail() public method

public getDetail ( )

getModels() protected method

Can be used with data providers such as \yii\data\ArrayDataProvider.
protected getModels ( ) : array
return array models

getName() public method

public getName ( )

getProfileLogs() public method

Returns all profile logs of the current request for this panel. It includes categories such as: 'yii\db\Command::query', 'yii\db\Command::execute'.
public getProfileLogs ( ) : array
return array

getQueryType() protected method

Returns database query type.
protected getQueryType ( string $timing ) : string
$timing string timing procedure string
return string query type such as select, insert, delete, etc.

getSummary() public method

public getSummary ( )

getSummaryName() public method

public getSummaryName ( ) : string
return string short name of the panel, which will be use in summary.

getTotalQueryTime() protected method

Returns total query time.
protected getTotalQueryTime ( array $timings ) : integer
$timings array
return integer total time

getTypes() public method

Returns array query types
Since: 2.0.3
public getTypes ( ) : array
return array

hasExplain() protected method

Since: 2.0.5
protected hasExplain ( ) : boolean
return boolean Whether the DB component has support for EXPLAIN queries

init() public method

public init ( )

isQueryCountCritical() public method

Check if given queries count is critical according settings.
public isQueryCountCritical ( integer $count ) : boolean
$count integer queries count
return boolean

save() public method

public save ( )

Property Details

$criticalQueryThreshold public_oe property

the threshold for determining whether the request has involved critical number of DB queries. If the number of queries exceeds this number, the execution is considered taking critical number of DB queries.
public $criticalQueryThreshold

$db public_oe property

the name of the database component to use for executing (explain) queries
public $db

$defaultFilter public_oe property

the default filter to apply to the database queries. In the format of [ property => value ], for example: [ 'type' => 'SELECT' ]
Since: 2.0.7
public $defaultFilter

$defaultOrder public_oe property

the default ordering of the database queries. In the format of [ property => sort direction ], for example: [ 'duration' => SORT_DESC ]
Since: 2.0.7
public $defaultOrder