Model save not syncing data
Closed this issue · 2 comments
progress44 commented
When saving a new model i.e. $user->save()
, the model itself isn't synced with the database. Getting the model data such as $user->id
returns null. At the moment it is necessary to reload the model but when you don't have an id it becomes difficult.
$user = new User();
$user->field = "xxxxx";
$user->save();
echo $user->id; // returns null
$user = User::findByField("xxxx");
echo $user->id; // returns ID
lastguest commented
Thanks, the standard Persistence save must be overriden for primary key population on first save. Will fix asap.
lastguest commented
Fixed in release 1.7.8