2

I'm trying to setup FOSUserBundle in a symfony 3.4 project. When accessing login page I get this error:

Unable to find template "FOSUserBundle::layout.html.twig" (looked into: app/Resources/views, vendor/symfony/symfony/src/Symfony/Bridge/Twig/Resources/views/Form) in @FOSUser/Security/login.html.twig at line 1.

Login template is actually found, but login template makes use of FOSUserBundle::layout.html.twig:

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

This is my tree in app/Resources folder, permissions and ownership seem to be ok:

app/Resources/
├── FOSUserBundle
│   ├── translations
│   │   └── FOSUserBundle.es.yml
│   └── views
│       ├── layout.html.twig
│       └── Security
│           └── login.html.twig
└── views
    ├── base.html.twig
    ├── default
    │   └── index.html.twig

This structure used to work in Symfony 2.8 projects. I've tried different locations with no luck.

BTW, translations are not being found also

Any ideas?

K. Weber
  • 2,643
  • 5
  • 45
  • 77
  • 1
    have you cleared cache after creating the files? New files do require `cache:clear`... – Jovan Perovic Aug 02 '18 at 11:01
  • Yes, I did (anyway I'm in dev mode) – K. Weber Aug 02 '18 at 11:20
  • 1
    "anyway I'm in dev mode" I do not think this makes any difference (in this case only), but nevertheless, good thing that you have cleared the cache... – Jovan Perovic Aug 02 '18 at 11:25
  • @emix that solves my problem, I'll accept duplicate though it'd be interesting to know what has changed from 2.8 to 3.4 for this to happen. Thanx – K. Weber Aug 02 '18 at 11:30
  • 2
    @K.Weber use `@FOSUser/layout.html.twig` instead. The current pattern `::` requires to install the Templating component + enabling the `Twig` engine to parse it correctly. – yceruto Aug 02 '18 at 11:46
  • 1
    What is it going on with the recent spate of closing questions as duplicate and then linking completely unrelated answers? Something is clearly going on. Are we earning rep now for closing things? In any event, @yceruto has the correct hint. [More info here](https://stackoverflow.com/questions/47832977/symfony-3-4-use-view-inside-my-bundle/47835716#47835716). – Cerad Aug 02 '18 at 12:02
  • @yceruto ok, I see what changed then. The other solution was also correct. – K. Weber Aug 02 '18 at 12:17
  • Did you tried with `{% extends "@FOSUserBundle::layout.html.twig" %}` – Dan Costinel Aug 02 '18 at 13:07

1 Answers1

0

Did you try {% extends "::layout.html.twig" %} ?

Ben Bezac
  • 14
  • 2