Search This Blog

Monday, 23 June 2014

Cakephp: Verifying the post data Failure.

When you save your data to DB using Model, some time if fails without any message, you can use codes to check what is happening. If the save fails, you will get print of data, validation error if any, and SQL statement executed.

 if ($this->Client->save($data)) {
     $this->Session->setFlash("Client Added");
          //to print the data itselft
          //to print the Validation Errors
          //to print the SQL statements
          debug($this->Client->getDataSource()->getLog(false, false));
          //to print the invlide fields