Cannot access protected property Drupal\search_api\Plugin\views\query\SearchApiQuery::$where in civicrm_entity_views_query_alter

Created on 29 November 2021, about 3 years ago
Updated 9 May 2024, 8 months ago

Problem

After installing this module, and having Search API in the site, when I go to a page that has a view that uses a search index I get the error:

The website encountered an unexpected error. Please try again later.
Error: Cannot access protected property Drupal\search_api\Plugin\views\query\SearchApiQuery::$where in civicrm_entity_views_query_alter() (line 505 of modules/contrib/civicrm_entity/civicrm_entity.module).
civicrm_entity_views_query_alter(Object, Object)
call_user_func_array('civicrm_entity_views_query_alter', Array) (Line: 403)
Drupal\Core\Extension\ModuleHandler->invokeAll('views_query_alter', Array) (Line: 537)

Steps to reproduce

  1. Create a view that uses a Search API index and place it somewhere in your site.
  2. Enable the civicrm_entity module.
  3. Go to see the view results.
  4. The site breaks with the error shown before.

Proposed resolution

Check what class corresponds to the query and get the conditions depending on it, so that if it is Drupal\search_api\Plugin\views\query\SearchApiQuery then we use the method getWhere, otherwise we access the property directly.

πŸ› Bug report
Status

Fixed

Component

Code

Created by

πŸ‡¨πŸ‡·Costa Rica dharizza

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