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

android - questions about switching from C2DM to GCM -

c++ - Qt setGeometry: Unable to set geometry -

batch file - How to extract all multi-volume RAR archives from subfolders of a folder? -