how can I debug a query that it what its going to run,
like
$this->Article->find('all',array开发者_Go百科('id'=>123));
is probably running something like
select * from articles where article.id = 123;
but how can I be sure and can see that in a debug or something.
thanks
Set app/core/config.php debug = 2
http://book.cakephp.org/view/924/The-Configuration-Class#CakePHP-Core-Configuration-Variables-931
@Ken's answer is correct, but I would recommend you downloading the debug_kit plugin; as it provides far more information than the standard output.
You will need to enable debug, as stated in the other answer; but the plugin adds a whole host of extras such as logging, performance, full SQL queries, history, variable dumps etc - definitely makes things easier for testing and general debugging.
精彩评论