Skip to content

@Template annotation generate wrong path #1138

@Holicz

Description

@Holicz

When you have controller named with two or more words (e.g. StaticPageController) and use @template annotation it generated folder StaticPage in views, but Symfony expects static_page.

Steps to reproduce

  1. Create this controller
class StaticPageController extends Controller
{
    /**
     * @Route("/about-us", name="about-us")
     * @Template
     */
    public function aboutUsAction()
    {
    }
}
  1. Use function "Twig: Create Template" (It creates Resources/views/StaticPage/AboutUs.html.twig)
  2. Run server
  3. Go to address /about-us

What is the result

Error message "Unable to find template "AppBundle/static_page/about_us.html.twig""

What should be the result

Plugin should generate folders and files with snake_case, not with camelCase (it is also written here in best practices)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions