Is there a way that one can cause CakePHP to dump its SQL log on demand? I'd like to execute code up until a point in my controller and see what SQL has been run.
Is there a way that one can cause CakePHP to dump its SQL log on demand? I'd like to execute code up until a point in my controller and see what SQL has been run.
If you are interested in some specific part of code, you can clear first the log, and then display only queries that happen after that point.
Also note that 'Model' below, is the actual class name, like User, Page etc.
//clear log (boolean $clear = true)
$this->Model->getDataSource()->getLog(false, true);
...
...
...
...
//Show log so far
$log = $this->Model->getDataSource()->getLog(false, false);
debug($log);
exit;