Skip to content

Commit b3850a4

Browse files
pana1990samdark
authored andcommitted
Fixes yiisoft#6890: Added ability to filter by query type
1 parent 07accd9 commit b3850a4

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

extensions/debug/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Yii Framework 2 debug extension Change Log
55
-----------------------
66

77
- Bug #6903: Fixed display issue with phpinfo() table (kalayda, cebe)
8+
- Enh #6890: Added ability to filter by query type (pana1990)
89

910

1011
2.0.2 January 11, 2015

extensions/debug/panels/DbPanel.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,4 +190,22 @@ public function isQueryCountCritical($count)
190190
{
191191
return (($this->criticalQueryThreshold !== null) && ($count > $this->criticalQueryThreshold));
192192
}
193+
194+
/**
195+
* Returns array query types
196+
*
197+
* @return array
198+
* @since 2.0.3
199+
*/
200+
public function getTypes()
201+
{
202+
return array_reduce(
203+
$this->_models,
204+
function ($result, $item) {
205+
$result[$item['type']] = $item['type'];
206+
return $result;
207+
},
208+
[]
209+
);
210+
}
193211
}

extensions/debug/views/default/panels/db/detail.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
'value' => function ($data) {
5050
return Html::encode(mb_strtoupper($data['type'], 'utf8'));
5151
},
52+
'filter' => $panel->getTypes(),
5253
],
5354
[
5455
'attribute' => 'query',

0 commit comments

Comments
 (0)