knp-components icon indicating copy to clipboard operation
knp-components copied to clipboard

Fixes error on complex where statements

Open Stumpftopf opened this issue 7 years ago • 7 comments

Fixes #205

Stumpftopf avatar Aug 13 '18 13:08 Stumpftopf

Hello @Stumpftopf ,

Thank you for your contribution, do you mind to write a test covering this fix ?

nicolasmure avatar Sep 07 '18 14:09 nicolasmure

Any chance to get that merged in time? I have the same problem.

markus-fischbacher avatar Sep 02 '19 19:09 markus-fischbacher

We can't merge it without tests

garak avatar Sep 02 '19 20:09 garak

@garak Thanks for the clearification. I‘ll fork the repo temporarly.

markus-fischbacher avatar Sep 02 '19 21:09 markus-fischbacher

This fix is also missing the case that $node->conditionalExpression can be another ConditionalPrimary.

An example where this happens is for

$expr->orX(
    $expr->between('event_date.dateFrom', ':start', ':end'),
    $expr->between('event_date.dateTo', ':start', ':end')
)

that since https://github.com/doctrine/orm/commit/550fcbc17fc9d927edf34bd0e5f9efc3b68ce344#diff-77ad6f787b65be81710fe85fee3d41f4b8e0b766446f8f24c28e0440b7eea17eR61 results in ((event_date.dateFrom BETWEEN :start AND :end) OR (event_date.dateTo BETWEEN :start AND :end)). Also true for other instances of unnecessary parenthesis (which are still valid DQL, though).

MisatoTremor avatar Nov 13 '20 18:11 MisatoTremor

I get a bug when i use the default search with a simple query together with andWhere

$qb = $em->createQueryBuilder()
            ->select('u')
            ->from('App:Participant','u')
            ->where('u.registration=:registration')->setParameter('registration',$registration->getId())
            ->andWhere('(u.isWaiting=0 or u.isWaiting is null)')
        ;

This patch works like a charm! Please merge!!

netfeld avatar Mar 22 '23 10:03 netfeld

This patch works like a charm! Please merge!!

As soon as we have some automatic tests to confirm that it works, I'll be glad to merge.

garak avatar Mar 22 '23 11:03 garak