It's a Views error, but I think it's related to ER. I know how to reproduce, but I can seem to solve yet :/

1) Attach a field to node
2) Attach same field to an entity without revisions (I did it on a message entity)

In Views I get
Notice: Undefined index: revision table in field_views_field_default_views_data() (line 182 of sites/all/modules/views/modules/field.views.inc).

Comments

Damien Tournoud’s picture

We don't do anything special around this. We just call the Views function passing it the unaltered field array.

amitaibu’s picture

Project: Entity reference » Views (for Drupal 7)
Version: 7.x-1.x-dev » 7.x-3.x-dev

Ok, I think it's a Views issue. The field I'm attaching is Entity reference. I see it's erroring somewhere in

    if (!empty($entity_info['entity keys']['revision']) && !empty($entity_info['revision table'])) {
      $data[$revision_table]['table']['join'][$entity_info['revision table']] = array(
        'left_field' => $entity_info['entity keys']['revision'],
        'field' => 'revision_id',
        'extra' => array(
          array('field' => 'entity_type', 'value' => $entity),
          array('field' => 'deleted', 'value' => 0, 'numeric' => TRUE),
        ),
      );

      $supports_revisions = TRUE;
    }
amitaibu’s picture

What I think that happens, is that this field has a revision on node, and Views assumes it has revision on all other entities as-well.

This results in the end with an Exception:

in views_plugin_query_default->execute() (line 1354 of /Applications/MAMP/htdocs/hv7/sites/all/modules/views/plugins/views_plugin_query_default.inc).

dawehner’s picture

This kind of errors happened before if you had the same field on two entites which aren't connected via relationships but via direct/automatic joins. Once you have this situation it's impossible to decide on which entity type your field actually is so probably the "wrong" one is chosen here, but this issue doesn't have that problem.

I tryed node and user with a normal textfield and it worked as expected

Notice: Undefined index: revision table in field_views_field_default_views_data() (line 182 of sites/all/modules/views/modules/field.views.inc).

This line number seems a bit out of date, what's the used line number if you use the current version of views?

amitaibu’s picture

> This line number seems a bit out of date, what's the used line number if you use the current version of views?

Might have copied it form older Views, but I've of-course tested on Dev as-well. My solution in the end was to attach a different field-name to the non-revisioned entity, and indeed it's hard for Views to know what's right.

> I tryed node and user with a normal textfield and it worked as expected

Oh, you mean it worked ok?

dawehner’s picture

Yes it worked for node + user without the notice. Maybe i should try messaging the next day.