ManyToOneHelper ignores group configuration for some cases

Created on 30 August 2015, almost 9 years ago
Updated 4 August 2023, 11 months ago

Bug description

We've met a buggy behaviour of a view having two reference-field filters in an OR subgroup.

That's how filters looked like:

And this is the resulting query:

There are two issues:
1. AND operator is used instead of OR one.
This is from hardcoded group identifier- value of 0 - for building adding where expression addWhereExpression which in some case will fail ... if the group is other than 0.
2. Even if OR operator would be used, INNER join breaks the OR logic.
The fix for this was included in the latest MR, originally it was being handled separately in 🐛 Incorrect filter group OR behavior, LEFT JOIN changed to INNER JOIN Closed: duplicate
This is from forcing INNER join - for performance - even the operator is OR for the current group.

Steps to reproduce

  1. Create 2 taxonomies
    and add some terms for both of vocabularies
  2. Create 2 taxonomy term reference fields
    And create different content
  3. Create a view with 2 filters for those 2 fields
  4. Play with AND and OR operators for those filters

Proposed resolution

on ManyToOneHelper

  • - Fix addWhereExpression usage by using the current option group
  • - Use INNER join only there is no OR operator for the current group

STR

1. Create new Drupal 8 installation with a Standard profile.
2. Export configuration.
3. Copy/replace files from attached configuration-parts.tgz.
4. Import/synchronize the configuration.
5. At admin/structure/views/settings enable the "Show the SQL query" option.
6. Visit admin/structure/views/view/many_to_one_test and see the resulting query.

Remaining tasks

-

🐛 Bug report
Status

Fixed

Version

11.0 🔥

Component
Views 

Last updated about 4 hours ago

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024