Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.3] Model push() method not working if only related models contain changed data #15196

Closed
claasjansen opened this issue Sep 1, 2016 · 3 comments

Comments

@claasjansen
Copy link

The push() method on Illuminate\Database\Eloquent\Model will only update the model and all of it relations if the model itself has changed. As the save() method now returns false if the model has not changed since the last time it has been, saved the push() method will skip updating the relations.

@KKSzymanowski
Copy link
Contributor

Yes, this is the case because push method calls $this->save() and it proceeds only if that didn't return false.

Also when you have something like Issue -> Comment -> Author and change only the Issue and Author models leaving Comment untouched, the push method will only update the Issue. Since Comment hasn't changed it will not even try to save it's related models.

I suppose you have to explicitly call save on related models until it's fixed.

@themsaid
Copy link
Member

themsaid commented Sep 5, 2016

That behaviour was fixed in #15236, however it's not released yet.

@KKSzymanowski
Copy link
Contributor

Glad to hear that.
How often do you release changes to Packagist?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants