Skip to content

[10.x] Fix duplicate conditions on retrying SELECT calls under createOrFirst()#48725

Merged
taylorotwell merged 2 commits intolaravel:10.xfrom
KentarouTakeda:fix/gh-48718
Oct 16, 2023
Merged

[10.x] Fix duplicate conditions on retrying SELECT calls under createOrFirst()#48725
taylorotwell merged 2 commits intolaravel:10.xfrom
KentarouTakeda:fix/gh-48718

Conversation

@KentarouTakeda
Copy link
Contributor

fixes #48718

@KentarouTakeda
Copy link
Contributor Author

@mpyw @tonysm

I think cloning the query builder (as suggested in the PR as a possible fix) on the first attempt should resolve the issue, but we need more testing.

I checked the existing implementations, but I couldn't find any parts that seemed to be affected. If you have any ideas please let me know. I'll try to fix it.

@tonysm
Copy link
Contributor

tonysm commented Oct 14, 2023

This is exactly how I thought I'd attempt it.👍

@SakiTakamachi
Copy link
Contributor

lgtm!

Copy link
Contributor

@mpyw mpyw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@GrahamCampbell GrahamCampbell changed the title fix: Duplicate conditions on retrying SELECT calls under createOrFirst() [10.x] Fix duplicate conditions on retrying SELECT calls under createOrFirst() Oct 14, 2023
@taylorotwell taylorotwell merged commit 2f88a30 into laravel:10.x Oct 16, 2023
@KentarouTakeda KentarouTakeda deleted the fix/gh-48718 branch October 16, 2023 22:28
timacdonald pushed a commit to timacdonald/framework that referenced this pull request Oct 24, 2023
…ateOrFirst()` (laravel#48725)

* fix: duplicate conditions with `firstOrCreate` and `createOrFirst`

* fix: missing mocks due to additional code
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.

[Known Issue] Duplicate conditions on retrying SELECT calls under createOrFirst()

5 participants