Cannot use parameter in Select Group Concat with BIT_AND IF condition #7388

Open
opened 2026-01-22 15:51:07 +01:00 by admin · 0 comments
Owner

Originally created by @CabanesThibault on GitHub (Jun 21, 2024).

Hi,

I encountered an issue while trying to build a query with a BIT_AND condition on a parameter in a Group Concat select statement.

The problematic line is:

Capture d’écran de 2024-06-21 14-39-07

The query (the aidant parameter is set later in a simple where clause, so it does exists in the query):

Capture d’écran de 2024-06-21 15-30-25

If I execute the query, I get an exception "the query define 1 parameter but you bound 2"

If I comment the "setParameter("teacherLeaved", STATUT)", I get an exception "the query define 2 parameters but you only bound 1"

If I explicitly define the value in the select BIT_AND and remove the "setParameter("teacherLeaved")", everything works well.

Capture d’écran de 2024-06-21 14-43-13

I'd tried to use BIT_AND(aa.status, (:teacherLeaved param)) as described here, for param in a select but it don't work neither (i also tried without the "param" at the end of the parenthesis).

I don't really get the point here, is there a reason or is it a lack of support for this kind of usage?

Right now to make it work, i'm just concatenating my value in the select clause and it works like a charm, but i would like to understand the problem.

Capture d’écran de 2024-06-21 15-19-56

Originally created by @CabanesThibault on GitHub (Jun 21, 2024). Hi, I encountered an issue while trying to build a query with a BIT_AND condition on a parameter in a Group Concat select statement. The problematic line is: ![Capture d’écran de 2024-06-21 14-39-07](https://github.com/doctrine/orm/assets/79976147/0d69244c-f3c4-43c0-b4f3-8763cf3df74d) The query (the aidant parameter is set later in a simple where clause, so it does exists in the query): ![Capture d’écran de 2024-06-21 15-30-25](https://github.com/doctrine/orm/assets/79976147/05c10551-c95c-41b2-9446-9b13759bd8c0) If I execute the query, I get an exception "the query define 1 parameter but you bound 2" If I comment the "setParameter("teacherLeaved", STATUT)", I get an exception "the query define 2 parameters but you only bound 1" If I explicitly define the value in the select BIT_AND and remove the "setParameter("teacherLeaved")", everything works well. ![Capture d’écran de 2024-06-21 14-43-13](https://github.com/doctrine/orm/assets/79976147/c2c00464-12e6-4210-9350-2a5b1fd706f6) I'd tried to use BIT_AND(aa.status, (:teacherLeaved param)) as described [here](https://stackoverflow.com/a/23384494), for param in a select but it don't work neither (i also tried without the "param" at the end of the parenthesis). I don't really get the point here, is there a reason or is it a lack of support for this kind of usage? Right now to make it work, i'm just concatenating my value in the select clause and it works like a charm, but i would like to understand the problem. ![Capture d’écran de 2024-06-21 15-19-56](https://github.com/doctrine/orm/assets/79976147/d05797d8-f7bf-47fd-af02-4ff7cbaced66)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#7388