mirror of
				https://github.com/yiisoft/yii2.git
				synced 2025-11-04 14:46:19 +08:00 
			
		
		
		
	Fixes #6890: Added ability to filter by query type
This commit is contained in:
		
				
					committed by
					
						
						Alexander Makarov
					
				
			
			
				
	
			
			
			
						parent
						
							07accd9b7d
						
					
				
				
					commit
					b3850a4e73
				
			@ -5,6 +5,7 @@ Yii Framework 2 debug extension Change Log
 | 
			
		||||
-----------------------
 | 
			
		||||
 | 
			
		||||
- Bug #6903: Fixed display issue with phpinfo() table (kalayda, cebe)
 | 
			
		||||
- Enh #6890: Added ability to filter by query type (pana1990)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
2.0.2 January 11, 2015
 | 
			
		||||
 | 
			
		||||
@ -190,4 +190,22 @@ class DbPanel extends Panel
 | 
			
		||||
    {
 | 
			
		||||
        return (($this->criticalQueryThreshold !== null) && ($count > $this->criticalQueryThreshold));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns array query types
 | 
			
		||||
     *
 | 
			
		||||
     * @return array
 | 
			
		||||
     * @since 2.0.3
 | 
			
		||||
     */
 | 
			
		||||
    public function getTypes()
 | 
			
		||||
    {
 | 
			
		||||
        return array_reduce(
 | 
			
		||||
            $this->_models,
 | 
			
		||||
            function ($result, $item) {
 | 
			
		||||
                $result[$item['type']] = $item['type'];
 | 
			
		||||
                return $result;
 | 
			
		||||
            },
 | 
			
		||||
            []
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -49,6 +49,7 @@ echo GridView::widget([
 | 
			
		||||
            'value' => function ($data) {
 | 
			
		||||
                return Html::encode(mb_strtoupper($data['type'], 'utf8'));
 | 
			
		||||
            },
 | 
			
		||||
            'filter' => $panel->getTypes(),
 | 
			
		||||
        ],
 | 
			
		||||
        [
 | 
			
		||||
            'attribute' => 'query',
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user