0

How do I loop multidimensional array in twig.

enter image description here

What I've tried is

{% for key, record in records %}

    {% for key1, record1 in record %}

         {{ key1 }}

     {% endfor %}

{% endfor %}

But I only get the index of array like so

  • 0
  • 0
  • 0
  • 0
  • 1
  • 0
  • 0
  • 1

What I want is to get the value of MoneyChanger and AddTransaction Array. Like for example

  • id
  • name
  • currency
  • amount
  • pieces

1 Answer 1

1

I want to post my answer.

I manage to resolve the issue by

{% for key, record in records %}

     {% for key1, record1 in record %}

           {% if record1.client is defined %}   

            {{ record1.id }}

           {% endif %}

     {% endfor %}

{% endfor %}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.