简体   繁体   中英

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 ?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM