Generating Symfony2 command-line characters in a global folder (advanced)

As I contacted the previous question , I asked and received an answer, I am posting this question to further improve the usability of the answer. The question was how to automatically generate branch templates in the global folder app/Resources/views/home/home.html.twig when using the php app/console generate:controller command. I received a workable answer to this question, which introduces the path to the global application folder like this:

 Templatename (optional) [AppBundle:Post:get.html.twig]: ::../../../../app/Resources/views/Post/get.html.twig 

The fact is that the generated template still has a sentence {% extends "::base.html.twig" %} with a double colon for the location of the AppBundle , as well as for entering a long sting path using ../../.. it would be too painful to repeat several times.

I'm wondering if there is a solution to really override the console command to take this into account? Symfony 3 automatically creates basic templates in 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 did not update this.

This question will be grateful for the answers to quality . A friend agreed to do this because I do not have enough reputation.

+1
source share

All Articles