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
Comment #2
bojanz commentedMy entity type is translatable so I didn't check the revision base table, but I'm guessing it has the same problem.
Comment #3
amateescu commentedDuplicate of #2652652: Provide a relationship from the revision table to the main table.
Comment #4
wim leers