Created
December 27, 2013 18:13
-
-
Save csrui/8150612 to your computer and use it in GitHub Desktop.
Get CakePHP last model's query
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function getLastQuery() { | |
$dbo = $this->getDatasource(); | |
$logs = $dbo->getLog(); | |
$lastLog = end($logs['log']); | |
return $lastLog['query']; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment