Symfony 2:多种选择分层形式

I'm using Symfony 2 and I'm building a site where I have a list of competences that the user can choose. I have succesfully built a form with the list of competences as checkboxes, however, the competences are ordered hierarchically, so I would like to show them using nested lists.

I have tried using a customized form field this way:

{% block _useredit_competences_widget %}
    {% for choice in choices %}
    <ul>
        <li>...</li>
    </ul>
    {% endfor %}
{% endblock %}

but the competences are in the plain array choices where I only can print the name, so I don't have access to the parents or children.

Any clue how can I achieve this?