Problem/Motivation

See #3415147: Computed field definitions created by inheritance have no provider set 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

  1. Install the Search API module and configure a search server.
  2. Install the Recurring Events module.
  3. Create a search index for eventseries entities.
  4. Add the event_instances field to the index.
  5. 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').

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

muriqui created an issue. See original summary.

muriqui’s picture

Issue summary: View changes

muriqui’s picture

Status: Active » Needs review

owenbush made their first commit to this issue’s fork.

  • owenbush committed c9cc4ee8 on 2.0.x authored by muriqui
    Issue #3415308: event_instances computed field has no provider set
    
owenbush’s picture

Status: Needs review » Fixed

Thanks for the patch, this has been merged.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.