Çağdaş DAĞ
Çağdaş DAĞ

Reputation: 3

Symfony FOSUserBundle Override Templates Not Working

I have a problem about Symfony FOSUserBundle Override Templates.

I tried

Create A Child Bundle And Override Template

way in this documentation.

I can override Controllers with this way but still can't override templates. I found a github demo about it and we have just 1 difference.

But my project is FOSUserBundle Controllers returning like ;

return $this->render('@FOSUser/Security/login.html.twig', $data);

In his project FOSUserBundle Controllers returning like ;

return $this->render('FOSUserBundle:Security:login.html.twig', $data);

I want to ask :

-If I change it manually and then if there is update for this bundle would it change it back ..

-When installing FOSUserBundle for my project I want it to be like in his project's. How can i achieve it ?

Upvotes: 0

Views: 517

Answers (1)

Mert Öksüz
Mert Öksüz

Reputation: 1071

You can't change the vendor's controller. If you want to change any code in FOSUserBundle controllers, you have to override it too. Which bundle overriding the FOSUserBundle, you can create own controllers in that bundle. After that you can use that for your own strategy.

Sample Bundle: https://github.com/mertoksuz/symfony2-rest/tree/master/src/RestApi/UsersBundle

Check this UsersBundle.

Thank you.

Upvotes: 1

Related Questions