Good afternoon,
By invoking the save method, execute the function Yii :: app () -> db-> lastInsertId I value returns 0, even if it has been saved successfully.
I’ve tried to do this in a new connection to avoid duplicate connections, but without success:
$conn = Yii::app()->db;
$conn->open();
$model->save();
$id = Yii::app()->db->lastInsertID;
$conn->close();
var_dump($id); die; //return 0
My table is with AUTO_INCREMENT.
Thank you!