Sometimes, whilst debugging, it is useful to see the last SQL query that CakePHP executed. This is easy if you are in the view, however not so easy in the Model or Controller.
Here’s how I over came the issue.
</span> $log = $this->TheModelName->getDataSource()->getLog(false, false); debug($log); <span style="line-height: 1.5em;">
Many thanks! very useful