because bundle inheritance is deprecated since Symfony 3.4 and will be removed in 4.0, I\'m finding a new solution. I have:
So I have recently needed same functionality and with help from comment @NicoHasse I managed to make working example
In your bundle bundle extension class you need to implement PrependExtensionInterface
and then you can modify twig paths. Then you need to know original namespace your you need to override (php bin/console debug:twig
).
You can confirm its working with twig debug command where you should see your path at first place of that namespace.
class YourExtensionClass extends Extension implements PrependExtensionInterface
{
public function prepend(ContainerBuilder $container)
{
$container->loadFromExtension('twig', [
'paths' => [
'%kernel.project_dir%/vendor/xx/yy/zzz' => 'OriginalVNamespace',
]
]);