Skip to content

[Template Inheritance] Missing note regarding different AppKernel location #4714

Closed
@linaori

Description

@linaori

I was having an issue regarding overriding twig template when following the TwigBundle example for custom error pages. The documentation points out that I should place it in app/Resources/TwigBundle/views/Exception/error.html.twig. I've tried this and it didn't work.

A little more context; I'm porting a Symfony1 application to Symfony2. Currently in a state where we have replaced 100% of the actions and we wanted to implement a fully Symfony2 error page.

Our AppKernel is located in a different directory: apps/myapp/lib/ due to compatibility with Symfony1. This was also the reason why the examples didn't work. Once I moved it to apps/myapp/lib/Resources/TwigBundle/views/Exception/error.html.twig, everything was working fine.

Scanning the docs, I missed a part where it mentioned that app/ is used because that's where the AppKernel is as it uses kernel.root_dir. I wasn't able to find a proper location to put this and a discussion on IRC with @wouterj pointed out that there might actually be more that needs moving around to solve this "confusion".

Metadata

Metadata

Assignees

No one assigned

    Labels

    TemplatingactionableClear and specific issues ready for anyone to take them.good first issueIdeal for your first contribution! (some Symfony experience may be required)hasPRA Pull Request has already been submitted for this issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions