Views integration for query access doesn't support chained entity reference conditions

Created on 14 October 2022, about 2 years ago
Updated 23 April 2024, 7 months ago

Problem/Motivation

It is possible to add a chain of entity references to a query access condition, e.g.:

$conditions->addCondition('field_mammals.entity:mammal.field_primates.entity:primate.field_title.value', 'Gorilla')

This works with everywhere Entity Queries are used, like in JSONAPI.

Views however builds queries in it's own way, and chained conditions will actually break the view.

Steps to reproduce

Create a query_access handler with a chained condition and a view to implement it.

Proposed resolution

Fix ViewsQueryAlter::mapConditions to also map the conditions when there is a chained entity reference.

Remaining tasks

Write a test to prove this works with:

- Base fields with cardinality 1
- Base fields with cardinality -1
- Config fields
- Multiple levels of chaining.

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Needs review

Version

1.0

Component

Views integration

Created by

πŸ‡ͺπŸ‡ΈSpain nuez Madrid, Spain

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.71.5 2024