A
A
Alex2014-12-06 11:33:35
Yii
Alex, 2014-12-06 11:33:35

Yii update doesn't always work, what's the problem?

Good afternoon.
I ran into a problem and I can't figure it out.
Some records are updated, some are not.
I even added 2 identical entries, in all respects, well, except for the id. One is updated, the other is not.

$blogs = Blogs::model()->findByPk($id);
$blogs->updated_at = new CDbExpression("NOW()");
$blogs->status = $status;
$blogs->save(); // возвразает false =(

Maybe it's validation, but how to get around?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergeyj, 2014-12-06
@sensus

To see the error.

if (!$blogs->save()) {
  print_r($blogs->getErrors());
  Yii::app()->end('error', true);
}

But I'm 99% sure that you have a validation problem though.
Execute false on save
$blogs->save(false);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question