We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I am trying to group in for loop using your extension. When I am trying to group by skillcategory it shows two times instead once.
skillcategory
Here is the data i get:
[ { "0": { "skillid": 1, "skillname": "PHP", "skillcategory": "Programing Langugages", "skilllevel": 62 }, "4": { "skillid": 5, "skillname": "C#", "skillcategory": "Programing Langugages", "skilllevel": 50 } }, { "1": { "skillid": 2, "skillname": "Walking", "skillcategory": Others, "skilllevel": 20 }, "2": { "skillid": 3, "skillname": "Jumping", "skillcategory": Others, "skilllevel": 100 }, "3": { "skillid": 4, "skillname": "Naping", "skillcategory": Others, "skilllevel": 80 } } ]
What I actually want to get
Programing Langugages PHP, C# Others Walking, Jumping, Naping
And it is my version of twig code:
{% for key, i in skills|group_by(=> _.skillcategory) %} {% for b in i %} <div>{{b.skillcategory}}</div> {{b.skillname}} {% endfor %} {% endfor %}
The text was updated successfully, but these errors were encountered:
Hi @neo-azazello You should put category name outside of the second for. Like this:
for
{% for key, i in skills|group_by(=> _.skillcategory) %} <div>{{key}}</div> {% for b in i %} {{b.skillname}}, {% endfor %} {% endfor %}
Sorry, something went wrong.
No branches or pull requests
I am trying to group in for loop using your extension. When I am trying to group by
skillcategory
it shows two times instead once.Here is the data i get:
What I actually want to get
And it is my version of twig code:
The text was updated successfully, but these errors were encountered: