php - View/Twig best practice: retrieve sub/child records in controller or view? -


i'm building application using twig , symfony, has general *vc.

when want retrieve child/sub/related records (for example subcategories of parent categories), should be:

  1. create nested array of data needed in controller , pass view/twig.
  2. retrieve sub records within view , loop through them there (initially passing in parent records).

this provided sub records can retrieved single method call or access single property. in view anyway, if requires more single method call, it's getting complex view.

i realize opinion based, i'm wondering if there best practices in general or twig or symfony.


Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -