Problem/Motivation

Use of this module led to an error with views related to 3294700.

Steps to reproduce

It requires having a view that uses an entity reference field as a filter with a fixed ID entered as "equals". In my instance, we had a homepage news view that used a group ID to ensure only items added to the home group would appear in that block. After enabling views_core_entity_reference, the = filter changed to a mutliselect with an in operator breaking the block view and causing a configuration mismatch. (And unfortunately, it wasn't caught with our automated tests and made it to production.)

Proposed resolution

TBD

Remaining tasks

TBD

User interface changes

None

API changes

TBD

Data model changes

TBD

Comments

joshuami created an issue.

joshuami’s picture

Oh interesting. I had not looked very closely at the code of this module before using it.

foreach ($field_configs as $field_config) {
    $table_name = $field_config->getTargetEntityTypeId() . '__' . $field_config->getName();
    $column_name = $field_config->getName() . '_target_id';
    if (
      isset($data[$table_name][$column_name]['filter']['id'])
      && in_array($data[$table_name][$column_name]['filter']['id'], ['numeric', 'string'])
    ) {
      $data[$table_name][$column_name]['filter']['id'] = 'entity_reference';
    }
  }

That changes the filter from a numeric string to a entity reference for all instances within views, but that's sort of a mismatch for any existing view. I'm not really sure this could be done in a way that doesn't break backwards compatibility unless enabling the module recursively updated every view with an existing entity reference filter.