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

Fixed bug in postSave logic that was wiping out relations before push() #243

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jcwatson11
Copy link

During the "saved" event, the reload() method is called, which, in turn calls getFreshInstance() and wipes out all relations that were on the model before save.

This breaks laravel's $model->push() method because it removes any relations that could be recursively saved.

Our use case involves a Hierarchical reference list that also carries translations as a relation. When we call push() all translations are wiped out because Baum loaded a fresh instance and tried to replace its relations with the empty set from the new model instance.

This pull request fixes that issue.

@jcwatson11
Copy link
Author

It appears that unit tests are failing in the master branch. As far as I can tell, the tests that are failing have nothing to do with this PR.

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

Successfully merging this pull request may close these issues.

1 participant