-
Notifications
You must be signed in to change notification settings - Fork 384
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
Possible bug in auditSync: Unexpected old/new values #931
Comments
I think the problem is here, using sync to append relations is tricky because as pointed out sync will reset the whole relationship. You would have to do something like $categories = $model->categories;
// remove D from categories
$categories->push($A);
$model->auditSync('categories', $categories); |
OK, then I misunderstood how it's supposed to work (basically old/new becomes removed/added). I think what confused me was this line in the docs:
Could be rephrased or extended. Thanks for the quick response. Closing this issue. I've also changed the title hoping it will be easier to discover by anyone having the same problem. |
I think so, you can open a PR to make it more understandable, English is not my language |
Actual Behaviour
The "old" and "new" values for
auditSync
don't make much sense to me, but because the documentation doesn't list an example I don't know if this is actually a bug or expected behavior.Expected Behaviour
At step 4, I'd expect Old to be "A, B, C", and New to be "B, C, D". In step 5, I'd expect Old = "B, C, D" and New = "C, D"
Steps to Reproduce
I wrote a simple failing test to illustrate: #930
The text was updated successfully, but these errors were encountered: