Routing Bundle
Use alias path to access the original Controller, (*1)
使用别名路径访问原始Controller, (*2)
Usage
composer require foreverglory/routing-bundle
AppKernel
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles[] = new Glory\Bundle\RoutingBundle\GloryRoutingBundle();
}
}
routing config routing.yml
, (*3)
homepage:
path: /homepage
defaults: { _controller: AppBundle:Default:index }
newpage:
path: /new
defaults: { _alias: homepage }
Code
//generate alias url
$url = $container->get('router')->generate('homepage');
//$url: /new
{{path("homepage")}}