Symfony2 commandline generation of twig templates under global folder (extended)

試著忘記壹切 提交于 2019-12-11 07:39:24

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!