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

Open
opened 2026-01-22 15:47:41 +01:00 by admin · 4 comments
Owner

Originally created by @mpoiriert on GitHub (Oct 29, 2023).

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:

609647a51a/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.

Originally created by @mpoiriert on GitHub (Oct 29, 2023). ### Bug Report <!-- Fill in the relevant information below to help triage your issue. --> | 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.
Author
Owner

@W0rma commented on GitHub (Jan 14, 2025):

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

@W0rma commented on GitHub (Jan 14, 2025): I stumbled over the same behaviour. I'm using `doctrine/orm:3.3.1` and `doctrine/dbal:4.2.1`
Author
Owner

@mpdude commented on GitHub (Mar 31, 2025):

Please try #11895

@mpdude commented on GitHub (Mar 31, 2025): Please try #11895
Author
Owner

@W0rma commented on GitHub (Apr 1, 2025):

@mpdude Works for me 👍

@W0rma commented on GitHub (Apr 1, 2025): @mpdude Works for me :thumbsup:
Author
Owner

@mpoiriert commented on GitHub (Apr 3, 2025):

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

@mpoiriert commented on GitHub (Apr 3, 2025): Didn't have time to test it but I have check the PR and it seems good 👍
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#7237