Fosuserbundle: Extends view not found

Created on 26 Dec 2016  路  30Comments  路  Source: FriendsOfSymfony/FOSUserBundle

Hello,

Since the implementation of the latest version two days ago, the heritagle of the views (to use those of my bundle and not those of FOSUserBundle) no longer works. Can someone explain me why please?

Most helpful comment

Why so many pissed of developers. Using development branch you should expect a lot of breakage especially when this in the process of refactoring.
I started with symfony way before it was stable. and in one of our product I had to rewrite forms at least 4 times. Am I pissed of no.

All 30 comments

They have been renamed. Have a look at Resources > views to have the new name. Mainly the "_" replace the "-". So you just have to rename your templates according to the new names.

Thank you

Hello,
I have look, but, I don't undertrand, my view name is "login.html.twig"

There is no way to use the views of my bundle that inherits from FOSUserBundle so?

I also would like to know:)
@stof

hmm, so the bundle inheritance does not allow to overwrite templates using the native Twig notation ? This looks like a bug in Symfony then.
However, I suggest you to use the app/Resources/FOSUserBundle/views folder to overwrite the FOSUserBundle templates anyway, as this is what the Symfony documentation is recommending since months (and maybe even years).

Regarding the bundle inheritance issue, I suggest you to open an issue on the symfony repo.

@stof
If I use the app/Resources/FOSUserBundle/views folder, then I can't extend like this:

{% extends "@CustomUser/base.html.twig" %}

I've got an error:
resource is hidden by a resource from the "CustomUserBundle" derived bundle

Can you give the full error message ? This is only part of it.

@axzx
Although I would like to keep all the views in my bundle, for me, the given solution works.
I think you put all the views in app/resources/views. You also have to move base.html.twig. It should be left in /src/CustomUserBundle/views this one.

@stof

[RuntimeException]
"app/Resources/FOSUserBundle/views/Security/login.html.twig" resource is hidden by a resource from the "CustomUserBundle" derived bundle. Create a "app/Resources/Custom
UserBundle/views/Security/login.html.twig" file to override the bundle resource.

It occurs only in command line cach:clear

Using Symfony 3.2.1 and latest FOSUserBundle commit, having templates in app/Resources/FOSUserBundle/views I can use both {% extends "FOSUserBundle::layout.html.twig" %} and {% extends "@FOSUser/layout.html.twig" %}. This takes my templates.

Well, if you access it as @CustomUSer/base.html.twig, it should indeed stay in CustomUserBundle (or in app/Resources/CustomUserBundle/views. If you want to put it in app/Resources/FOSUserBundle/views, you indeed need to reference it as FOSUserBundle.

Hi,
I have difficulties to understand. This problem comes from symfony?
If you are in prod and need to fix quickly

cd vendor/friendsofsymfony/user-bundle && git checkout 612649c4efe02fb7d618652a449999d3b6c935d6

Or downgrade to "friendsofsymfony/user-bundle": "2.0.x-dev#612649c", into your composer.json file.

See Symfony documentation - Overriding Resources: Templates, Routing, etc
Try use long version @FOSUserBundle/Resources/views/.... instead of short @BundleName/... in the FOSUserBundle action render.

another ridiculous update.
i had enough. until i completely remove this broken bundle, i ended up fixing specific commit in composer:
"friendsofsymfony/user-bundle": "dev-master#c0ba63245f4155b3bc7060298089c2bf806cc002",

@gondo
I do not agree with you.
If bundle developers do not meet symfony best practices it will become unreasonable.
FOSUser is still a great job that no more restructuring time would be wasted for sf developers.

@kmelia Thank you I just discovered this practice

Why so many pissed of developers. Using development branch you should expect a lot of breakage especially when this in the process of refactoring.
I started with symfony way before it was stable. and in one of our product I had to rewrite forms at least 4 times. Am I pissed of no.

@Discutea you're welcome ;)

@mvrhov totally agree! We use development branch to get latest updates, but we know that is dev ;)
Do composer install only (with the composer.lock file) on production platforms ;)

Can you please check if symfony/symfony#21077 would solve your issue?

@xabbuh yes, it's works for me!

@kmelia it's fix in Symfony 3.2.1 ?

@Thibault34 https://github.com/symfony/symfony/pull/19586 is not merged yet

Ha ok, thank

@Thibault34 nope, I just try the fix on my project ;)

@kmelia Could you try out symfony/symfony#19586 instead and let us know if it works for you?

@chalasr I will try tomorrow morning.

@chalasr the PR does not work on a 3.x branch, so I could not test!

Closing in favor of #2378 (no need to keep 2 opened issues tracking this)

Was this page helpful?
0 / 5 - 0 ratings