Hello All,
In this blog we will discuss about how to enable the SQL dump in your CakePhp's controller.
For this you have to write in below code in your controller function-
$db=ConnectionManager::getDataSource('default');
$db->showLog();
The above code will show a log of all queries that is requested in from your controller function.
Example-
public function abc(){
$this->layout="default";
$userData=$this->User-find('all');
//Below code to run SQL dump on your controller
$db=ConnectionManager::getDataSource('default');
$db->showLog();
$this->set('userData',$userData);
}
0 Comment(s)