The entity from field relationship currently checks for the source column when it looks for valid relationships. This is wrong since we are looking into getting a relationship through the field to the destination column, and the two columns doesn't really match all the time, for instance in the Entity reference module, where the source column is called target_id.

The attached patch uses array_search instead to find the destination column rather than the source column.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Damien Tournoud’s picture

Status: Needs review » Reviewed & tested by the community

This is correct, the definition of a relationship is indeed source column => destination column.

merlinofchaos’s picture

Damien Tournoud’s picture

Those two definitely touch the same part of the code. There is *a lot* going on in the other patch, so it is unclear what the exact rationale for it is. This said, the buggy line is still in the other patch, so I would recommend getting this one in (as it is an obvious bug fix), and looking if the other is still necessary after that.

fabsor’s picture

Status: Reviewed & tested by the community » Closed (duplicate)

I think both patches are working on solving the same problem. I have merged both patches and added a it in #1394124: Accurately reference foreign keys in entity_from_field relationship.