collection@ filterBy in scheme #732
Answered
by
giuscris
RWDevelopment
asked this question in
Q&A
-
is it possible to filter collection in scheme like: $site->descendants()->filterBy('amountOfMagic', fn($value) => $value >= 100) eg. collection@: site.descendants.filterBy('amountOfMagic', fn($value) => $value >= 100) ? |
Beta Was this translation helpful? Give feedback.
Answered by
giuscris
Jul 19, 2025
Replies: 2 comments
-
This is not possible, the query language used in schemes doesn't support closures. It's not PHP. I think now it makes sense to add some filter methods like this: collection@: site.descendants.filterBy('amountOfMagic', '>=', 100) And these filter could be We are in time to alter the API just before Formwork 2.0. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
RWDevelopment
-
@RWDevelopment see #733 for the implementation |
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
This is not possible, the query language used in schemes doesn't support closures. It's not PHP.
I think now it makes sense to add some filter methods like this:
And these filter could be
==
,!=
,===
,!==
,>
,>=
,<
,<=
, etc. (we can add more in the future)We are in time to alter the API just before Formwork 2.0.