orm icon indicating copy to clipboard operation
orm copied to clipboard

ManyToManyPersister don't generate proper matching query for "in"

Open mpoiriert opened this issue 2 years ago • 2 comments

Bug Report

Q A
BC Break no
Version 2.16.2

Summary

Matching criteria in ManyToManyPersister (maybe other) doesn't work with "in".

Error is here:

https://github.com/doctrine/orm/blob/609647a51a1b28a674de270204a5cea3af57d554/lib/Doctrine/ORM/Persisters/Collection/ManyToManyPersister.php#L257

Current behavior

When using in the value is not in using "(:value)" but just :value

Error would be something like this:

or the right syntax to use near '? LIMIT 1' at line 1

How to reproduce

Do a matching request with a criteria with in:

$this->collection
            ->matching(
                Criteria::create()
                    ->where(
                        Criteria::expr()
                            ->in(
                                'status',
                               [$value1, $value2]
                            )
                    )
            )
            ->count();

Expected behavior

Query shoudl be generated properly.

mpoiriert avatar Oct 29 '23 14:10 mpoiriert

I stumbled over the same behaviour. I'm using doctrine/orm:3.3.1 and doctrine/dbal:4.2.1

W0rma avatar Jan 14 '25 15:01 W0rma

Please try #11895

mpdude avatar Mar 31 '25 20:03 mpdude

@mpdude Works for me :thumbsup:

W0rma avatar Apr 01 '25 05:04 W0rma

Didn't have time to test it but I have check the PR and it seems good 👍

mpoiriert avatar Apr 03 '25 15:04 mpoiriert