API for traversing Relationship
s and RelationshipTarget
s in dynamic contexts
#21601
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Objective
Currently there is no way to traverse relationships in type-erased contexts or to define dynamic relationship components, which is a hole in the current relationships api.
Solution
Introduce
RelationshipAccessor
to describe a way to getEntity
values from any registered relationships in dynamic contexts and store it onComponentDescriptor
. This allows to traverse relationships without knowing their type, which is useful for working with entity hierarchies using non-default components.Testing
Added a simple test/example of how to use this api to traverse hierarchies in a type-erased context.