CakePhp Get SQL Consuly String
// As long as your query is not executed by toArray(), all() or something similar,
// you can use $q->sql() to retrieve the raw sql query that cakePHP will execute:
// Example:
$q = $this->Model->find();
var_dump($q->sql()); // raw sql query
Maximilian Mewes (it. Carl)