Problem/Motivation
See
π
Computed field definitions created by inheritance have no provider set
Fixed
for related issue in field_inheritance.
The event_instances
computed field created by recurring_events_entity_base_field_info_alter()
does not set a provider (module). If this field is then used in a Search API index, it causes the search index config to be exported with a dependency on a null module, which in turn causes the following error when the config is imported:
Configuration search_api.index.my_index depends on the "" module that will not be installed after import.
Steps to reproduce
- Install the Search API module and configure a search server.
- Install the Recurring Events module.
- Create a search index for eventseries entities.
- Add the event_instances field to the index.
- Export the config.
Expected results: The exported search_api.index.my_index.yml should contain values similar to the following:
dependencies:
config:
- search_api.server.elasticsearch
module:
- search_api
- recurring_events
and
field_settings:
event_instances:
label: 'Event Instances'
datasource_id: 'entity:eventseries'
property_path: event_instances
type: integer
dependencies:
module:
- recurring_events
Actual results: The config declares dependencies on a null module, like so:
dependencies:
config:
- search_api.server.elasticsearch
module:
- ''
- search_api
- recurring_events
and
field_settings:
event_instances:
label: 'Event Instances'
datasource_id: 'entity:eventseries'
property_path: event_instances
type: integer
dependencies:
module:
- null
Proposed resolution
On the $fields['event_instances'] = BaseFieldDefinition::create('entity_reference')
statement chain, call ->setProvider('recurring_events')
.