1

Should be simple enough. Everything works in my local environment, but not on my prod server (neither prod nor dev environment). I get an error that the FOS template cannot be found:

Unable to find template "FOSUserBundle::layout.html.twig".   

My code is simple:

{% extends "FOSUserBundle::layout.html.twig" %}

I'm going from my local Windows machine to a Linux box. I've read case sensitivity might be the culprit, but it doesn't seem like it.

The FOS bundle is in the normal place: vendor/friendsofsymfony/user-bundle/FOS/UserBundle.

I'm having trouble diagnosing - any ideas? Did things get screwed up when I FTPd? Permissions issues? What are the common gotchas? I'm desparate!

Update: A clue. I ran assetic:dump and got

[RuntimeException]
".../app/Resources/FOSUserBundle/views/layout.html.twig" resource is hidden by a 
resource from the "*******Bundle" derived bundle. Create a
".../app/Resources/*******Bundle/views/layout.html.twig" file to override the bundle 
resource.

This question seems relevant.

Another update: I was using getParent() in my own bundle to override the templates. I switched to the first method in the docs but now the templates in app/resources simply aren't having an effect. It's going straight to the default form template with a white background.

Any ideas?

Community
  • 1
  • 1
Sam Selikoff
  • 12,366
  • 13
  • 58
  • 104

3 Answers3

3

It was a upper/lower case/namespacing thing. I thought my local files were in sync with remotes but they were not.

Just check your whole directory & all namespaces in the FOS bundle!

Sam Selikoff
  • 12,366
  • 13
  • 58
  • 104
0

I also encountered the problem and "solved" it by renaming my layout.html.twig inside my bundle's Resources/views folder to bundle-layout.html.twig and adapting my templates accordingly.

ixM
  • 1,244
  • 14
  • 29
0

I resolved the resource is hidden by a resource error by moving the template in the good bundle extension.

Specifically from app/Resources/FOSUSerBundle/views/ChangePassword
to src/Application/Sonata/UserBundle/Resources/views/ChangePassword

I confounded FOSUser & SonataUser.

Pierre de LESPINAY
  • 44,700
  • 57
  • 210
  • 307