Skip to content

[9.x] Fix BelongsToMany#updateOrCreate behaviour merge arguments for new models #35827

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

Merged
merged 2 commits into from
Jan 8, 2021
Merged

Conversation

marcoboers
Copy link
Contributor

@marcoboers marcoboers commented Jan 8, 2021

This fixes an issue with that the behavior of the updateOrCreate method on BelongsToMany relationships is not merging the $attributes and $values arrays.

This is different from the behaviour of the updateOrCreate methods on Builder, HasOneOrMany and HasManyThrough classes and from the documented behavior "If no such flight exists, a new flight will be created which has the attributes resulting from merging the first argument array with the second argument array" eloquent#upserts.

Fixes #35798

@driesvints
Copy link
Member

@marcoboers it's best that you give a detailed explanation in your PR description at what this fixes. Otherwise this PR will probably get closed.

@marcoboers
Copy link
Contributor Author

@driesvints Thanks, I have updated the description.

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.

3 participants