-1

For instance, the logged user information displaying on all pages (in base.html.twig).

Alexander
  • 287
  • 4
  • 13
  • The reusable logic should be put in to classes and then configure them as services. The most specific parts yet reusable should be instances in the points that you need it and pass them the needed services. I do this to avoid getting a huge dependency container. Just a personal opinion. – Carlos Dec 14 '16 at 21:29
  • No. For symfony, it has only certain correct answer. Here it is: https://symfony.com/doc/2.8/templating/embedding_controllers.html You would have been aware of if you were expert in the area. Sorry, you are wrong. Why similar questions are OK, but this one not? lol http://stackoverflow.com/questions/33005685/how-to-share-the-common-logic-between-controller-in-express-js http://stackoverflow.com/questions/31966321/how-to-share-common-logic-between-controllers (doesn't relate to any framework) http://stackoverflow.com/questions/17453204/angularjs-share-methods-between-controller – Alexander Dec 15 '16 at 06:27
  • my previous comment relates to @gp_sflover – Alexander Dec 15 '16 at 06:37
  • @Carlos I agree. However embedding action result is a good recommended practice. Please look the link above :) – Alexander Dec 15 '16 at 06:37
  • @Alexander your linked questions are not related to Symfony but clearly demonstrate how to add a bit of necessary context to make a question more useful and in-topic (_as requested by SO rules_) and just read the title of this question to get the differences. Without describing a specific use case it's pretty useless give an answer like the your below, with only a link and even without an implementation example, **Don't exists a unique way that resolve any problem**. PS: there are many ways to make a task in Symfony and many variables to consider to decide in which way resolve it. – gp_sflover Dec 15 '16 at 13:19

1 Answers1

0

Nice solution is to embed controller (action) result into template: https://symfony.com/doc/current/templating/embedding_controllers.html

Alexander
  • 287
  • 4
  • 13