Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
entity-from-field-check-destination-column-1.patch | 881 bytes | fabsor |
Comments
Comment #1
Damien Tournoud CreditAttribution: Damien Tournoud commentedThis is correct, the definition of a relationship is indeed
source column => destination column
.Comment #2
merlinofchaos CreditAttribution: merlinofchaos commentedIs this related to #1394124: Accurately reference foreign keys in entity_from_field relationship ?
Comment #3
Damien Tournoud CreditAttribution: Damien Tournoud commentedThose 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.
Comment #4
fabsor CreditAttribution: fabsor commentedI 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.