How to get database logs on firebug for ajax requests

The following is a code extract on how to do it:

$profiler = new Zend_Db_Profiler_Firebug(‘All DB Queries’);
$profiler->setEnabled(true);

// Attach the profiler to your db adapter
// $db->setProfiler($profiler);
foreach($this->getConfig()->resources->multidb as $dbName => $infos) {
$this->getFrontController()->getParam(‘bootstrap’)->getResource(‘multidb’)->getDb($dbName)->setProfiler($profiler);
}

$this->request = new Zend_Controller_Request_Http();
$this->response = new Zend_Controller_Response_Http();
$this->channel = Zend_Wildfire_Channel_HttpHeaders::getInstance();
$this->channel->setRequest($this->request);
$this->channel->setResponse($this->response);

ob_start();

//do your stuff here including database requests

$this->channel->flush();
$this->response->sendHeaders();

Facebook Comments

Oct, 10, 2016

 

0

SHARE THIS