Doctrine 1.x log all queries

To log all queries we need to use Event Listeners class QueryDebuggerListener extends Doctrine_EventListener { public function preStmtExecute(Doctrine_Event $event) { $q = $event->getQuery(); $params = $event->getParams(); while (sizeof($params) > 0) { $param = array_shift($params); if (!is_numeric($param)) { $param = sprintf(“‘%s'”, $param); } $q = substr_replace($q, $param, strpos($q, ‘?’), 1); } error_log($q); } } $queryDbg =Continue reading “Doctrine 1.x log all queries”