Replies: 1 comment
-
Definitely open to this (anything to simplify ElementRelationParamParser!). |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The
ElementQuery::relatedTo
is a powerful (and universal) way to build query relationships via a field, but most of logic is hard coded outside the control of a field type. Granted a field type can modify the query using theFieldInterface::modifyElementsQuery()
method, but there is a lot of logic within theElementRelationParamParser
class and things get ugly when there's that much copy->paste to mimic the same logic.What if the relatedTo condition logic was delegated to the field type? Looking at
vendor/craftcms/cms/src/elements/db/ElementRelationParamParser.php:256
we're already iterating against the fields ... could we create and call a new method that would handle the logic?I remember discussing this a while back. We're currently working on a couple field types that are similar to Matrix where they have child fields that can be related against.
Beta Was this translation helpful? Give feedback.
All reactions