I'm building an application using Twig and Symfony, but this really has to do with general *VC.
When I want to retrieve the child/sub/related records (for example subcategories of the parent categories), should I be:
- Create a nested array of the data needed in the controller and pass it to the view/Twig.
- Retrieve the sub records within the view and loop through them there (initially passing in the parent records).
This is provided the sub records can be retrieved with a single method call or access to a single property. In my view anyway, if it requires more than a single method call, it's probably getting too complex for the view.
I realize this is somewhat opinion based, but I'm wondering if there are best practices in general or specifically for Twig or Symfony.