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

findMany breaking change #45582

Closed
Boorinio opened this issue Jan 10, 2023 · 3 comments · Fixed by #45584
Closed

findMany breaking change #45582

Boorinio opened this issue Jan 10, 2023 · 3 comments · Fixed by #45584
Labels

Comments

@Boorinio
Copy link
Contributor

Boorinio commented Jan 10, 2023

  • Laravel Version: v9.46.0
  • PHP Version: 8.1
  • Database Driver & Version: MySql 5.7

Description:

#45453 On this pr and in the release of 9.46 the behaviour of findMany changed.
Consider the following query Category::query()->findMany($categoryIds) where the categoryIds has the following format:
array:2 [
0 => array:1 [
"category_id" => 34234234
],
1 => array:1 [
"category_id" => 6756767567
]
];

And because it would use the regular whereIn method it would basically flatten the array resulting in the query
"where id IN (34234234,6756767567)".

After that change we are using the IntegerInRaw which casts the array to int resulting in the query of where id IN (1,1).

Don't know if that was intentional or not but it does change the previous behaviour.

Steps To Reproduce:

Basically pass an array of arrays in the findMany in latest version of the framework

@driesvints
Copy link
Member

Thanks for your report. We're reverting this.

@imanghafoori1
Copy link
Contributor

@Boorinio Thanks for mentioning it. I proposed a fix here: #45584

@Boorinio
Copy link
Contributor Author

@Boorinio Thanks for mentioning it. I proposed a fix here: #45584

Yeah seems fine!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants