Skip to content

aki77/akWebDebugPanelPropel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

akWebDebugPanelPropel
==============

sfWebDebugPanelPropel に以下の表示を追加します。

 * Explain結果の表示・警告
 * 指定回数以上のクエリが発行された場合の警告


Example
=======

frontendConfiguration.class.php

<?php

class frontendConfiguration extends sfApplicationConfiguration
{
    public function configure()
    {
    }

    public function initialize()
    {
        if (sfConfig::get('sf_web_debug')) {
            $this->dispatcher->connect('debug.web.load_panels', array($this, 'webLoadPanelEvent'));
        }
    }

    public function webLoadPanelEvent($event)
    {
        $debug = $event->getSubject();
        $panel = new akWebDebugPanelPropel($debug);

        // デフォルトのexplain警告条件を差し替え
        // $panel->setIsWarningCallable(array($this, 'isWarningExplain'));

        $debug->setPanel('db', $panel);
    }

    public function isWarningExplain($explain)
    {
        foreach ($explain as $v) {
            if ($v['type'] == 'ALL' || preg_match('!filesort|temporary!', $v['Extra'])) {
                return true;
            }
        }

        return false;
    }
}


databases.yml

dev:
  propel:
    param:
      classname:  DebugPDO
      debug:
        realmemoryusage: true
        dsn: true
        query_count:  20
        explain:
          type:  '/index|ALL/'
          Extra: '/filesort|temporary/'
        details:
          time:       { enabled: true }
          slow:       { enabled: true, threshold: 0.1 }
          mem:        { enabled: true }
          mempeak:    { enabled: true }
          memdelta:   { enabled: true }

About

sfWebDebugPanelPropel に Explain の結果を追加表示

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages