Skip to content

View location bug with Symfony 2.8.3 #17969

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
brechtdewinne opened this issue Mar 1, 2016 · 11 comments
Closed

View location bug with Symfony 2.8.3 #17969

brechtdewinne opened this issue Mar 1, 2016 · 11 comments

Comments

@brechtdewinne
Copy link

When upgrading Symfony from 2.8.2 to 2.8.3 I have noticed that the following no longer works:

return $this->container->get('templating')->renderResponse(
    '@BaseBundle/SubDir/Resources/views/view.html.twig', []
);

Directory structure: /src/Base/SubDir/Resources/views/view.html.twig

Symfony throws an exception saying that the view cannot be found inside app/Resources/views.

@linaori
Copy link
Contributor

linaori commented Mar 1, 2016

I'm not sure if that was ever supported as the default structure would've been loading templates from your view directory.

@brechtdewinne
Copy link
Author

It have been using this long before 2.8 :)

@linaori
Copy link
Contributor

linaori commented Mar 1, 2016

That doesn't mean it's a supported notation though, I wasn't aware that this was possible in the first place. Supported notations are here: http://symfony.com/doc/current/book/templating.html#template-naming-and-locations

If this is intended to work, it should be fixed of course.

@brechtdewinne
Copy link
Author

Namespaced path support was introduced in 2.2.

Unless support for this has been removed and I missed that along the way.

@linaori
Copy link
Contributor

linaori commented Mar 1, 2016

You could add your own twig namespace: http://symfony.com/doc/current/cookbook/templating/namespaced_paths.html

@brechtdewinne
Copy link
Author

And why would I want to do that when it worked perfectly fine before?

This sounds more like a workaround for a bug then anything else...

@linaori
Copy link
Contributor

linaori commented Mar 1, 2016

I'm not saying you'd want to do that. I'm saying you could do that to get it to work in the newer version. If it's a bug, it can be fixed. If it was something that was possible but not intended to be, your solution will keep your system working. However, I recommend to stick to the documentation or best-practices regarding template locations.

@Jean85
Copy link
Contributor

Jean85 commented Mar 1, 2016

I think this is the same as #17777

@linaori
Copy link
Contributor

linaori commented Mar 1, 2016

In that case, @brechtdewinne can you try if this fix works for you? #17894

@jakzal
Copy link
Contributor

jakzal commented Mar 1, 2016

Indeed, this should be fixed by #17894. @Jean85 if you could confirm your case is fixed it would be great, thanks!

The problem in my view is that people were relying on few unsupported cases, which obviously were not covered by tests.

@jakzal jakzal closed this as completed Mar 1, 2016
@brechtdewinne
Copy link
Author

@iltar Yes that fixes the issue!
CC: @Jean85 @jakzal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants