Skip to content
This repository has been archived by the owner on Jun 18, 2019. It is now read-only.

A new record is not saved if there are no changed fields #26

Closed
freekmurze opened this issue Jun 20, 2014 · 5 comments
Closed

A new record is not saved if there are no changed fields #26

freekmurze opened this issue Jun 20, 2014 · 5 comments

Comments

@freekmurze
Copy link

Consider this new User object (translatable-trait is not used in the model)

$user = new User();
$user->save();
echo $user->id //returns 1 (if your user table was empty), db-record created

It's a bit silly to store a user without properties, but the point i want to make is that normally a record without any properties get saved in the db with only the id.

Now consider this new News object (translatable-trait is used on this model)

$news = new News();
$news->save();
echo $news->id //returns NULL, record is not saved in the db

The record should be saved even when no properties are set.

@dimsav
Copy link
Owner

dimsav commented Jun 20, 2014

Thanks! Bug noticed :)

Will be fixed soon!

@freekmurze
Copy link
Author

nice!

@dimsav
Copy link
Owner

dimsav commented Jun 20, 2014

Should be fixed in v4.2.1. Can you please confirm?

Thanks!

@freekmurze
Copy link
Author

yep, this bug is fixed. Party!

@dimsav
Copy link
Owner

dimsav commented Jun 20, 2014

Nice!

@dimsav dimsav closed this as completed Jun 20, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants