Twig: render controller versus macro

I want to know what is best for rendering a controller in a branch or using a macro. For example, we have a page on which we post a message with its comments.

  • In one hand, we can load a comment in the controller that displays the message and pass it as an argument to the twig macro to change the list of comments
  • on the other hand, we can create a controller that takes a post as an argument and makes it a branch that displays a message

Which one is best? I am using symfony2

+4
source share
2 answers

, , , .

:

Twig, ( ). Twig , , , . , , Twig. , . , , , .

, , , .

, , , . , , Twig , . Twig , .

+2

TwigExtension, , . ...

0

All Articles