My Userbundle well extends fosUserBundle and works well.
Problem: My template UserBundle../.../..layout.html.twig does not override my FosUserBundle../.../..layout.html.twig.
It's the same path(/SymfonyProject/src/moi/UserBundle/Resources/views/layout.html.twig) in my UserBundle.
My website use the FOS template instead of my new one. I've cleared the cache.
<?php
namespace moi\UserBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class moiUserBundle extends Bundle
{
public function getParent()
{
return 'FOSUserBundle';
}
}
moiUserBundle.php:
My versions of twig and fosUB in composer.json:
"friendsofsymfony/user-bundle" : "~2.0@dev",
"twig/twig" : "~1.28"
Finally works by putting the template in : app/Resources/FOSUserBundle/views/layout.html.twig. And copying controllers from FOSUserbundle/Controller to my UserBundle/Controller.
I mixed first and second method advised in the doc : http://symfony.com/doc/current/bundles/FOSUserBundle/overriding_templates.html .