i'm trying to overwrite Symfony2 Router located at vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php
i've followed this tutorial and i've created my own bundle and registered it in AppKernel.php
.
<?php
// src/My/SymfonyBundle/MySymfonyBundle.php
namespace MySymfonyBundle;
use SymfonyComponentHttpKernelBundleBundle;
class MySymfonyBundle extends Bundle
{
public function getParent()
{
// die('test');
return 'FrameworkBundle';
}
}
so fat all good. my bundle has been recognized (tested by trying die('test');
in function above)
than i've created my extended version of Symfony2 Router
<?php
// src/My/SymfonBundle/Routing/Router.php
namespace MySymfonyBundle;
use SymfonyBundleFrameworkBundleRoutingRouter as BaseRouter;
die('test');
class Router extends BaseRouter
{}
but it has been ignored. i expected to see my debug test
message however my overwritten file is not loaded at all.
i've also seen this question but i that doesn't look clear at all.
how to overwrite Symfony2 core bundle (vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php
) or core component (vendor/symfony/symfony/src/Symfony/Component/Routing/Router.php
) properly?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…