Description
Summary
A new issue has been introduced between 4.1.5 and 4.1.8, and is also present on https://demo.orocrm.com/
When Applying a segment, query is not processed correctly.
[Semantical Error] line 0, col 1993 near 'filter__gpnpmultiEnum2': Error: 'filter__gpnpmultiEnum2' is already defined. in /var/www/orocrm/vendor/doctrine/orm/lib/Doctrine/ORM/Query/QueryException.php:65
My guess is the issue was introduced in b1516a3
UPDATE : Did some investigation and issue is caused by 7e6c6e3
EDIT : Reformat for clarity
Steps to reproduce
Edit any contact and set Contact Method Phone
Create a segment Test WITH RESULTS BUT WRONG
OUTPUT :
- Create a segment
Test WITHOUT SEGMENT
[Semantical Error] line 0, col 1993 near 'filter__gpnpmultiEnum2': Error: 'filter__gpnpmultiEnum2' is already defined. in /var/www/orocrm/vendor/doctrine/orm/lib/Doctrine/ORM/Query/QueryException.php:65
Actual Result
Test NO RESULTS
Getting grid data failed.
exception: "Doctrine\ORM\Query\QueryException:
QUERY :
SELECT
t1.id
FROM
Oro \ Bundle \ ContactBundle \ Entity \ Contact t1
WHERE
t1.id IN(
SELECT
ts1443173037.id
FROM
Oro \ Bundle \ ContactBundle \ Entity \ Contact ts1443173037
WHERE
ts1443173037 IN(
SELECT
filter__gpnpmultiEnum2
FROM
Oro \ Bundle \ ContactBundle \ Entity \ Contact filter__gpnpmultiEnum2
INNER JOIN filter__gpnpmultiEnum2.myField filter__gpnpmultiEnum3_rel
WHERE
filter__gpnpmultiEnum3_rel IN(:_gpnpmultiEnum1)
) AND ts1443173037.id IN(
SELECT
ts1845229959.id
FROM
Oro \ Bundle \ ContactBundle \ Entity \ Contact ts1845229959
WHERE
ts1845229959 NOT IN(
SELECT
filter__gpnpmultiEnum2
FROM
Oro \ Bundle \ ContactBundle \ Entity \ Contact filter__gpnpmultiEnum2
INNER JOIN filter__gpnpmultiEnum2.myField filter__gpnpmultiEnum3_rel
WHERE
filter__gpnpmultiEnum3_rel IN(:_gpnpmultiEnum1)
)
)
)
in /var/www/orocrm/vendor/doctrine/orm/lib/Doctrine/ORM/Query/QueryException.php:43
`Test WITH RESULTS BUT WRONG
A Contact is found BUT SHOULD NOT since NO contacts have Contact Method set at BOTH Phone
and Email
at the same time
Test WITHOUT SEGMENT
Ok, Good. No result shown as expected, and no error. All 3 segments should be identical
Expected Result
Order of OP when using AND operands should not mather, or produce error.
a AND b
should provide the same result as b AND a
Details about your environment
- OroPlatform version: x.y.z
- PHP version: x.y.z
- Database (MySQL, PostgreSQL) version
Additional information