baum icon indicating copy to clipboard operation
baum copied to clipboard

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

Open jcwatson11 opened this issue 9 years ago • 1 comments

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 avatar Aug 05 '16 01:08 jcwatson11

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.

jcwatson11 avatar Aug 05 '16 13:08 jcwatson11