question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@Template annotation generate wrong path

See original GitHub issue

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)

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:7
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
TomasVotrubacommented, Nov 11, 2019

Fixed by #1389

0reactions
TomasVotrubacommented, May 27, 2020

Blast from the past, I have no idea.

I’d try to add it to ide-twig.json (example)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why wrong path annotation doesn't crash REST API with ...
Don't really know. However, worth to try with a correct Path annotation. Maybe it is ignoring it as it was wrong. Try to...
Read more >
Configure annotation processors | IntelliJ IDEA Documentation
The annotation processor can validate, generate, and modify your code ... you need to add a path of the annotation processor JAR manually....
Read more >
Java Annotation Processing and Creating a Builder - Baeldung
Here's an example of adding annotation processor for the compiler plugin. You could also specify the directory to put generated sources into, ...
Read more >
Creating a RESTful Root Resource Class - The Java EE 6 ...
The @Path annotation identifies the URI path template to which the resource ... The ResponseBuilder class provides a convenient way to create a...
Read more >
Agent Sidecar Injector Annotations | Vault
To map a path to a specific secret, use the same unique secret name: vault.hashicorp.com/secret-volume-path-SECRET-NAME . For example, if a secret annotation ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found