RelationQuery is hard-coded to force the range to be limited to the first 50 results. This should be left up to the user like the default implementation of EntityFieldQuery.
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | relation_query_range_deleted-1700538-11.patch | 2.43 KB | mikran |
| #5 | relation_query-range-1700538-5.patch | 853 bytes | mikran |
| #1 | relation-limit-on-relation-query-1700538-1.patch | 1.88 KB | Anonymous (not verified) |
Comments
Comment #1
Anonymous (not verified) commentedPatch attached.
Comment #2
chx commentedI am very hesitant on committing this. As RelationQuery extends EntityFieldQuery if one is not satisfied with the 0, 50 range per default, it's easy to skip relation_query and just do a new RelationQuery and then call ->range.
Comment #3
mikran commentedIt was not a long ago that I figured out that it was RelationQuery thas was setting the default range. Initially, as a coder, I quickly checked the RelationQuery class and thought it was just EFQ with the related method. So I agree with Brian here, the class extends EFQ and the added range default looks more like a personal preference that is likely to confuse many.
Comment #4
chx commentedHrm. What about a doxygen patch on relation_query then?
Comment #5
mikran commentedI don't think it's as much a problem with relation_query(). What if we move the range from class constructor to relation_query(patch does this)?
Comment #6
chx commentedPlease go ahead and commit this.
Comment #7
mikran commentedcommitted
Comment #9
mikran commentedThis is not good yet.
Relation API uses relation_query() a lot, without taking care of results beyond 50. For example relation_entity_delete() does that, which means if any entity is part of over 50 relations only first 50 be checked for deletion. So either we remove range() from relation_query as well or convert all occurrences of relation_query to RelationQuery.
Comment #10
chx commentedComment #11
mikran commentedWhere can I find that Rules option?
I don't think it's possible to create a batch in hook.
This patch fixes other points
Comment #12
mikran commented#1570510: relation_entity_delete() is unneccesarily destructive. is related issue and relation_entity_delete is being fixed there.
Comment #13
mikran commentedCommitted, without relation_entity_delete improvements that is.
Comment #15
andyg5000In troubleshooting why Search API was only loading 50 relations, I realized that the pseudo entity wrapper property for relations calls relation_rules_get_related_entities to load the related entities. This method has a hard limit of 50 as mentioned in above. @chx suggests that the 50 limit be passed as a default rules option (I'm guessing he means rules parameter).
There are three reasons I'm confused here:
1) relation_rules_get_related_entities is NOT defined as a rules action in hook_rules_action_info. Do we need to write an action to call this and have limit as a parameter?
2) If no, relation_rules_get_related_entities is only used to define properties of the entity in relation_entity_property_info_alter(), so why is it in the rules file?
3) If the 50 limit is for preventing potential memory/timeout issues, is the alter below the best way around this situation
Comment #16
mikran commentedThis issue was about RelationQuery and relation_query() (and over year old already). Please open a new issue with this.
Comment #17
andyg5000Related #2259195: Rules integration and hard limit of 50 on relation_query
Comment #18
attiks commentedFYI: Icreated a follow up issue to fix a bug in the dummy field: #2501067: relation_dummy_field_field_prepare_view should not over write existing items