OK, this can be very strange. This is not the first time I am working on a symfony project, but:
I used the symfony generate: bundle command, and after that I created the package. Let's call it "CrimeBundle".
I saw that he created a folder inside src /
He also automatically created DefaultController and the index.html.twig file.
Now when I use:
return $this->render('CrimeBundle:Default:index.html.twig');
it does not work: I get an error message:
Cannot find the pattern "CrimeBundle: Default: index.html.twig" (viewed: / Users / admin / sites / solve / app / Resources / views, / Users / admin / sites / solve / vendor / symfony / Symfony / SRC / Symfony / bridge / twig / resources / views / form).
however, it works whenever I use a path with names with names:
return $this->render('@Crime/Default/index.html.twig');
I like the first option, because in my other projects I also use it. None of them are the same version, I am currently using: 3.4.1 Again, there is a file because it works with branch paths with names.
I do not understand why return $this->render('CrimeBundle:Default:index.html.twig'); will not work as symfony generated this code.
source share