Create a view of entity revisions. Try to add a non-revisionable field to the view ("Type", for example). Notice that it's missing.

NodeViewsData adds a relationship manually:

    $data['node_field_revision']['nid']['argument'] = [
      'id' => 'node_nid',
      'numeric' => TRUE,
    ];
    // @todo the NID field needs different behaviour on revision/non-revision
    //   tables. It would be neat if this could be encoded in the base field
    //   definition.
    $data['node_field_revision']['nid']['relationship']['id'] = 'standard';
    $data['node_field_revision']['nid']['relationship']['base'] = 'node_field_data';
    $data['node_field_revision']['nid']['relationship']['base field'] = 'nid';
    $data['node_field_revision']['nid']['relationship']['title'] = $this->t('Content');
    $data['node_field_revision']['nid']['relationship']['label'] = $this->t('Get the actual content from a content revision.');

    $data['node_field_revision']['vid'] = [
      'argument' => [
        'id' => 'node_vid',
        'numeric' => TRUE,
      ],
      'relationship' => [
        'id' => 'standard',
        'base' => 'node_field_data',
        'base field' => 'vid',
        'title' => $this->t('Content'),
        'label' => $this->t('Get the actual content from a content revision.'),
      ],
    ] + $data['node_field_revision']['vid'];

We need to generalize this code and put it in EntityViewsData.

I am also unsure why there's both a nid and a vid relationship here (causing them to also show up double in the UI).

Comments

bojanz created an issue. See original summary.

bojanz’s picture

My entity type is translatable so I didn't check the revision base table, but I'm guessing it has the same problem.

amateescu’s picture

Status: Active » Closed (duplicate)
wim leers’s picture