-
-
Notifications
You must be signed in to change notification settings - Fork 825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SearchKit - proper EntityRef joins #26192
Conversation
(Standard links)
|
e596421
to
3325075
Compare
@@ -366,6 +366,24 @@ public static function getJoins(array $allowedEntities):array { | |||
} | |||
} | |||
} | |||
// Custom EntityRef joins |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MegaphoneJon did you happen to notice what in the above code stops it from working for custom fields already? I would have thought their metadata would have triggered it to include them since they do declare a fk_entity
like other fields.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@colemanw I'm not sure which of places you mean by "above code", but:
- Line 329 references
fk_entity
but is in anif ($bridge)
conditional. - Lines 273-319 handle non-bridge joins, but only loops through
$references
. Since$references
comes from$dao::getReferenceColumns()
it doesn't handle custom fields. addImplicitFKFields()
works correctly (because of your work on SearchKit - Fix handling of new Custom EntityReference fields #25927), but onlygetJoins()
modifies$joins
. This leaves a scenario where you can hackcivicrm_saved_search.api_params
to retrieve the fields you want - but you can't select the joins in the SK UI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, makes sense. Ok.
Thanks for adding a test.
This is planned to be released with 5.63.0, just noting for documentation. |
Overview
#25927 improved the state of EntityRef custom fields in SearchKit, but didn't allow displaying fields in the joined table other than the primary key. This allows a proper join to EntityRef records.
To replicate
Before
You can see only the ID and pseudoconstant lookup of the EntityRef.
After
You can join fully to the EntityRef record, and join to the referenced record as usual.
Comments
This join is in one direction only - because I don't see a good way to join to a custom field. You'd have to join from Contact to Contribution, then Contribution to custom field table.