because bundle inheritance is deprecated since Symfony 3.4 and will be removed in 4.0, I\'m finding a new solution. I have:
Here's a more comprehensible example
Let's start with making some assumptions
Your bundle's name: AcmeBundle
Bundle you want to override: FOSUserBundle
Run command php bin/console debug:twig
and find the namespace of the bundle you want to override. In this case it's @FOSUser
.
Your bundle extension should look like this
loadFromExtension('twig', array(
'paths' => array(
'%kernel.project_dir%/src/AcmeBundle/Resources/FOSUserBundle/views' => 'FOSUser', // You use the namespace you found earlier here. Discard the `@` symbol.
),
));
}
}
Now you can create src/AcmeBundle/Resources/FOSUserBundle/views/Security/login.html.twig
to override the login template of FOSUserBundle.
This was just an example for FOSUserBundle. You can change bundle names depending on what you're trying to override.