Not working for filters for elements/columns of Compound Fields - Attempt to read property "value" on null

Created on 17 October 2023, about 1 year ago

Problem/Motivation

It seems https://www.drupal.org/project/views_autocomplete_filters/issues/3345680 🐛 Attempt to read property "value" on null in src/Controller/ViewsAutocompleteFiltersController.php on line 220 Needs review
still "valid" for Compound fields, as Address field.
The current code, assumes that $view_entity->$real_field_name it should be there.

Steps to reproduce

Create an Address field and use (for example) its locality in View as both field and filter with autocomplete.
There should be similar error as mentioned in https://www.drupal.org/project/views_autocomplete_filters/issues/3345680 🐛 Attempt to read property "value" on null in src/Controller/ViewsAutocompleteFiltersController.php on line 220 Needs review

Proposed resolution

Check existence of the field $view_entity->$real_field_name
And if not, return the "View result" value. There could be sevaral ways for Compound field is built and also its Views integration.
So, maybe something $view_entity->$real_field_name->property will not always work.

Remaining tasks

---

User interface changes

---

API changes

---

Data model changes

---

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

🇷🇴Romania vasike Ramnicu Valcea

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

Comments & Activities

Production build 0.71.5 2024