Problem/Motivation

This is a follow-on to #2725725: [FEATURE] Add support for filtering collections and #2792399: [BUGFIX] Prevent sort parameters from overriding filter parameters with numeric indices.

The classes in the Query namespace represent the engine which turns filters, pagination, and sort query parameters into an actual Drupal Entity query.

The QueryBuilder is not tested. This means that while we can be confident that a filters, groups, sorts and pages work on an individual basis, we cannot be confident that these all work in unison. There are probably more issues like #2792399: [BUGFIX] Prevent sort parameters from overriding filter parameters with numeric indices because of this. Testing the QueryBuilder class will hopefully uncover and help fix similar issues.

Proposed resolution

The result of this issue will be a patch that creates Unit tests for the QueryBuilder class that exercises many different combinations of query parameters. We should also probably have at least one Kernel test to test the class from start to finish.

Technical background

QueryOptions are the internal representation of something like filter[0][condition][field]=field_foo&filter[0][condition][value]=bar. Each type of QueryOption 'knows' how to apply itself to a query, i.e., every QueryOption has an apply method which takes a QueryInterface and modifies the query according to its own values. These are already well tested.

Above the QueryOptions is the QueryBuilder class. The QueryBuilder compiles a list of all QueryOptions and forms them into a tree. For example, ConditionOptions and GroupOptions have the methods insert and getParent. These allow conditions and groups to form tree representing nested condition sets.

Comments

gabesullice created an issue. See original summary.

gabesullice’s picture

Issue summary: View changes
gabesullice’s picture

Status: Active » Closed (outdated)