yii

Log model error after save

This code:

$model = new SomeModel();
$model->attributes = $attributes;
$model->save();
Yii::log("errors saving SomeModel: " . var_export($model->getErrors(), true));

Will log:

2014/07/31 22:57:59 [info] [application] errors saving SomeModel: array (
  'date' => 
  array (
    0 => 'Date cannot be blank.',
  ),
)

Published by

Konrad Fedorczyk

I'm interested in programming and gamedev. I especially luv HTML5 and everything connected to web technologies.

Leave a Reply

Your email address will not be published.