I'm using OG field on several entity types, besides node. When we added field to custom entity type - views started to throw MySQL error.
We've found bug in `OgBehaviorHandler.class.php`file in views_data_alter method. Instead of populating $data['og_membership']['table']['join'] value with all available entity types, it adds join only for last entity type in the list.
List of entity types we have:
0 node
1 formulary
2 locator
Actual Result:
[table] => Array (
[join] => Array (
[locator] => Array (
[left_field] => lid
[field] => etid
[extra] => Array (
[0] => Array (
[field] => entity_type
[value] => locator
)
)
)
)
)
Expected result:
Array (
[table] => Array (
[join] => Array (
[node] => Array (
[left_field] => nid
[field] => etid
[extra] => Array (
[0] => Array (
[field] => entity_type
[value] => node
)
)
)
[formulary] => Array (
[left_field] =>
[field] => etid
[extra] => Array(
[0] => Array (
[field] => entity_type
[value] => formulary
)
)
)
[locator] => Array (
[left_field] => lid
[field] => etid
[extra] => Array (
[0] => Array (
[field] => entity_type
[value] => locator
)
)
)
)
)
)
Comments
Comment #2
he0x410 commentedPatch added.
Comment #3
he0x410 commentedComment #4
markpavlitski commentedWe're seeing this same issue when using OG and EntityReference in Views. We're not using custom entity types though, just several together (node, users, field collections).
Here's a simplified patch which achieves the same thing.
Comment #5
David_Rothstein commentedThe code looks good, and I can verify that this patch fixed the problem for me also.
Comment #6
jacob.embree commentedThis helped me too. Unassinging x610.
Comment #7
alesr commentedComment #8
jacob.embree commentedThe GitHub pull request for this issue is https://github.com/Gizra/og/pull/383.
Comment #10
alesr commented