Get database row affected by model->save()


I have a table in MySQL which has a auto_increment PK, and i need to know the value of this PK after i saved the model. From what i understand this is exactly what PHP mysql_affected_rows() does when Inserting a row.

Is it possible to extract this data from $model->save() in any way? Or do i need to take another approach and in such case how?



If the autoincrement field is ID… you can just read it’s value like $model->id…

Wow that way easy :)