Project

General

Profile

Actions

Bug #62421

closed

Using array of constrains with "logicalAnd" or "logicalOR" results in strange nested queries

Added by Dennis Biedermann over 9 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2014-10-23
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
5.2
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

If you collect a set of constrains within an array and try to combine those constraints with "logicalAnd" or "logicalOr", the result is a strange nested query.

Example

$customerConstraints = array(
    $query->equals('companyNo', 1),
    $query->equals('customerNo', 4711),
    $query->equals('customerAddrNo', 3)
);
$constraints = $query->logicalAnd($customerConstraints);

This should create a sql statement like:

... companyNo = '1' AND customerNo = '4711' AND customerAddrNo = '3'

but instead the result is something like this:

... (company_no = '1' AND customer_no = '9330') AND customer_addr_no = '0'

And it even gets worse if you add more constrains or try to combine different constraint sets with another "logicalAnd" or "logicalOr":
Here's a live example

        (
            (
                (
                    (
                        (
                            last_name LIKE '%Bier%' OR middle_name LIKE '%Bier%'
                        ) OR
                        first_name LIKE '%Bier%'
                    )
                    OR
                    street LIKE '%Bier%'
                )
                OR zip LIKE '%Bier%'
            )
            OR
            city LIKE '%Bier%'
        ) AND
        (
            (
                (    
                    (
                        last_name LIKE '%Hund%' OR middle_name LIKE '%Hund%'
                    ) OR
                    first_name LIKE '%Hund%'
                )
                OR
                street LIKE '%Hund%'
            ) OR
            zip LIKE '%Hund%'
        ) OR
        city LIKE '%Hund%'
    )
)

This is the result of simple addition of two constraint array with "logicalOr".

IMHO this is a crucial bug and should be fixed ASAP.


Files

dump1.png (53.4 KB) dump1.png Dennis Biedermann, 2014-10-23 12:46
Actions

Also available in: Atom PDF