Refresh model data

Here is the code:




//DB trigger changes id to some value...


echo $model->id;

//still 0 !!!


What is wrong? And how to get $model->id correct value?

Thank you in advance.

Try to don’t set $model->id. I think it is being checked for NULL before assignment in save() method.

First off, don’t set model id if it is a new row. Secondly, don’t call refesh. Model id is set for you by AR.