I think that views relationships do not work as expected. Here is an example.

1. We have a single node.
2. We have 3 revisions for this node. Each revision has appropriate title: Rev1, Rev2, Rev3.
3. We have 3 custom entities which have entity_reference_revisions field to specific revision of the node.

Here is a table to make the text above clear.

+-----------+----------------------+------------+
| Entity    | Node                 | Node Title |
+-----------+----------------------+------------+
| Entity #1 | Node #1, Revision #1 | Rev1       |
+-----------+----------------------+------------+
| Entity #2 | Node #1, Revision #2 | Rev2       |
+-----------+----------------------+------------+
| Entity #3 | Node #1, Revision #3 | Rev3       |
+-----------+----------------------+------------+

The goal is to render each entity with appropriate node title in table with Views. Entity Reference Revisions module has views support and I'm able to make a relationships to the content referenced via the field.

And here is how the result looks like.

+-----------+------------+
| Entity    | Node Title |
+-----------+------------+
| Entity #1 |            |
+-----------+------------+
| Entity #2 |            |
+-----------+------------+
| Entity #3 | Rev3       |
+-----------+------------+

That's because the relationships target base table is wrong.

I'd like to propose the patch which will help to render the table as expected.

+-----------+------------+
| Entity    | Node Title |
+-----------+------------+
| Entity #1 | Rev1       |
+-----------+------------+
| Entity #2 | Rev2       |
+-----------+------------+
| Entity #3 | Rev3       |
+-----------+------------+

I think that this is appropriate behavior for the entity_reference_revisions module.
It's goal to reference specific revision, but not a content (with the latest revision).

Comments

danylevskyi created an issue. See original summary.

danylevskyi’s picture

Here is a patch.

danylevskyi’s picture

Assigned: danylevskyi » Unassigned
Status: Active » Needs review
miro_dietiker’s picture

This is at least related, if not duplicate to #2799479: Views doesn't recognize relationship to host

I would be very happy to have proper Views integration, but we can't commit such fixes without test coverage.

miro_dietiker’s picture

Status: Needs review » Needs work
idebr’s picture

Status: Needs work » Closed (duplicate)

The base table is also being adjusted in #2799479: Views doesn't recognize relationship to host. Let's close this issue as a duplicate, so we can focus our efforts in the related issue.