Skip to content
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

Add filter, map and reduce filters with support for arrow functions #652

Open
OxCom opened this issue Jul 3, 2019 · 3 comments · May be fixed by #874
Open

Add filter, map and reduce filters with support for arrow functions #652

OxCom opened this issue Jul 3, 2019 · 3 comments · May be fixed by #874

Comments

@OxCom
Copy link

OxCom commented Jul 3, 2019

There are few nice features were added to Twig.

Please add support for this features. At current stage compilation process fails on parse mode of such constructions like:

{% for product in related_products|filter(product => product.stock > 10) %}
    {# ... #}
{% endfor %}
@julkue
Copy link

julkue commented Jul 9, 2019

I'm missing this soo much....

@willrowe willrowe changed the title Add filter, map and reduce features Add filter, map and reduce filters with support for arrow functions Apr 3, 2023
@willrowe
Copy link
Collaborator

willrowe commented Apr 3, 2023

As mentioned in #861, the following needs to be done:

  1. Add support for arrow functions in limited contexts to match where TwigPHP allows them.
  2. Allow arrow functions to be used in filters that already exist like sort.
  3. Add filter, map, and reduce filters that rely on support for arrow functions.

Could one of the maintainers point me out into the right direction; would you like this implemented as a logic token type or as an expression type?
@antoineveldhoven which one does TwigPHP use? Trying to match that would be a good start, if possible.

@JulienLavocat
Copy link

Hello,

We are currently migrating part of our existing Symfony applications to a new infrastructure and this is a blocking issue for us. I'll be glad to contribute but it would be nice if you could please give me some leads to start implementing this properly :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants