This is continuing from a previous post here. My twig file below can go two levels and using for loops but I have much more children within the children. The object contains an array of arrays and is in a hierarchical order. I am looking for a recursive solution if possible. It may be also helpful but not necessary that I am using bootstrap.
Twig:
{% extends 'CompanyMyBundle::base.html.twig' %}
{% block body -%}
<h1>Org list</h1>
<table class="records_list">
<thead>
<tr>
<th>name</th>
<th>parentid</th>
<th>id</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for entity in entities %}
<tr>
<td><a href="{{ path('org_show', { 'id': entity.Id }) }}">{{ entity.Name }}</a></td>
<td>{{ entity.ParentId }}</td>
<td>{{ entity.Id }}</td>
<td>
<ul>
<li>
<a href="{{ path('org_show', { 'id': entity.Id }) }}">show</a>
</li>
<li>
<a href="{{ path('org_edit', { 'id': entity.Id }) }}">edit</a>
</li>
</ul>
</td>
</tr>
{% for child in entity.children %}
<tr>
<td><a href="{{ path('org_show', { 'id': child.Id }) }}">{{ child.Name }}</a></td>
<td>{{ child.ParentId }}</td>
<td>{{ child.Id }}</td>
<td>
<ul>
<li>
<a href="{{ path('org_show', { 'id': child.Id }) }}">show</a>
</li>
<li>
<a href="{{ path('org_edit', { 'id': child.Id }) }}">edit</a>
</li>
</ul>
</td>
</tr>
{% endfor %}
{% endfor %}
</tbody>
</table>
<ul>
<li>
<a href="{{ path('org_new') }}">
Create a new entry
</a>
</li>
</ul>
{% endblock %}