Category: Yii

  • How to replace one GET var in Yii 1.1.* when using form?

    How to replace one GET var in Yii 1.1.* when using form?

    I’ve needed URL with one variable replaced so it wouldn’t be duplicated every request. I’ve came up with this simple solution:

  • Log model error after save

    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.’, ), )