How to Get Last Executed Query in Cakephp? Here, I have to print the Last Executed Query to check what query is generating.
For print Last Executed Query in Cakephp, you can use this…
$dbo = $this->ModelName->getDatasource();
$logs = $dbo->getLog();
$log = end($logs['log']);
echo "<pre>"; print_r($log); echo "</pre>";
Here, ModelName is the Query from Model Name
For more Click Here