Not all fields that have a target_type setting are entity references

Created on 16 October 2023, about 1 year ago
Updated 10 December 2023, about 1 year ago

Problem/Motivation

Indexing a field of type plugin_reference, provided by https://www.drupal.org/project/pluginreference β†’ , is throwing this exception:

Drupal\Component\Plugin\Exception\PluginNotFoundException while adding Views handlers for field Content Β» Source on index Published entities index: The "eu_oss_catalogue.provider" entity type does not exist. in Drupal\Core\Entity\EntityTypeManager->getDefinition() (line 139 of /Users/clau/development/joinup/web/core/lib/Drupal/Core/Entity/EntityTypeManager.php).

In my case the field is referring a plugin whose plugin manager service ID is plugin.manager.eu_oss_catalogue.provider.

The exception is possible due to the fact that PluginReferenceItem is also exposing a target_type setting and _search_api_views_get_handlers() assumes that all fields having this setting are entity reference fields, which isn't the case.

Steps to reproduce

Add a plugin_reference field and clear the cache. Check the logs.

Proposed resolution

In _search_api_views_get_handlers(), check whether the field is an entity reference field.

Remaining tasks

None.

πŸ› Bug report
Status

Fixed

Version

1.0

Component

Views integration

Created by

πŸ‡·πŸ‡΄Romania claudiu.cristea Arad πŸ‡·πŸ‡΄

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

Comments & Activities

Production build 0.71.5 2024