我在我的应用路由文件中定义了一个路由:
RouteName:
    pattern:  /some/route
    defaults: { _controller: MyAppBundle:Controller:action }
在控制器中,我可以使用:
$this->get('router')->generate('RouteName');
我将如何简单地从我创建的新类中访问它,例如不扩展任何内容的视图类:
namespace My\AppBundle\View;
class ViewClass {
    public function uri()
    {
        return getTheRoute('RouteName');
    }
}