问题
As related to a previous question i asked, and got an answer to, i'm posting this question to further enhance the usability of the answer, the question was how to automatically generate the twig templates under the global folder app/Resources/views/home/home.html.twig
while using php app/console generate:controller
command. i got a workable answer to this, which is entering the path to the global app folder like so
Templatename (optional) [AppBundle:Post:get.html.twig]: ::../../../../app/Resources/views/Post/get.html.twig
The thing is the generated template still has the {% extends "::base.html.twig" %}
clause with double colon for the AppBundle
location, and also typing out the long sting path with the ../../..
would be too painful to do repeatedly.
Im pondering if there is a solution to actually override the console command itself to accommodate this? symfony 3 automatically generates base templates under the global folder and the best practice for symfony 2 is to have templates inside the global folder, i don;t know why the creators have not updated this.
There will be a bounty for quality answers on this question a friend has agreed to do so since i do not have enough reputation.
来源:https://stackoverflow.com/questions/38280852/symfony2-commandline-generation-of-twig-templates-under-global-folder-extended