Code Is Poetry

Life is Binary

Cakephp

cakephp bake setup and migration command for windows7

migration guide slideshare link http://www.slideshare.net/andolasoft/how-to-migrate-cake-php-1x-to-2x   cake bake setup for cake bake set the following path in environment variable EDIT by putting semicolon first In the System Variables box, find the “Path” variable and click “Edit…” ;d:\wamp\bin\php\php5.5.12;d:\wamp\www\emailmarketing\app\Console;   cmd cd d:\wamp\www\emailmarketing\app;run cake upgrade all     cake bake...

Read more

The last run query log in Cakephp

To debug and see the last run query in cakephp 2 you need to put the following code in AppModel.php and then call the method using through controller model method.AppMode.phpfunction getLastQuery() {   $dbo = $this->getDatasource();   $logs = $dbo->getLog();   $lastLog = end($logs['log']);   return $lastLog['query']; } SomethingsController.phpdebug($this->Something->getLastQuery());

Read more

Cakephp 2.x disable strict errors

In config/core.php find the line Configure::write('Error', array('handler'=>'ErrorHandler::handleError','level'=> E_ALL &~E_DEPRECATED,'trace'=>true)); and replace 'level' with this: 'level'=> E_ALL &~E_STRICT &~E_DEPRECATED,

Read more

Cakephp getting last executed sql query for debugging purpose

Sometimes it is necessary to trace the last sql query run by cakephp find method as it does a lot of work underneat, Following is a neat little function does this for you. function getLastQuery() { $dbo = $this->getDatasource(); $logs = $dbo->getLog(); $lastLog = end($logs['log']); return $lastLog['query']; }

Read more