I find it hard to explain my problem so i will write in a schematic way.
Rule is : One route -> one Controller::method -> one child template which is part of a parent template called by {% extends "default.twig" %}, when you use twig.
Ok, let's have a blog app, with a page binding :
- the list of posts or one post by his ID - route is 'blog' Controller is 'blog', method is 'index', data will be displayed in the child template
- list of categories - no route, data is displayed in the parent template
- list of last ten posts - no route, data is displayed in the parent template
in controller 'blog', method 'index', code will retrieve list of post, send it to template, but also retrieve list of categories, and list of ten last posts
Same in controller 'blog' method 'show', retrieve one post by his ID, list of categories, and list of ten last posts.
This is ugly and violate DRY rule.
What is the better way to do this ?
Thanks for help
Eric