渲染过程中抛出异常?

An exception has been thrown during the rendering?

我想从我的树枝文件中获取 "PublisherId"。

它 returns 我一个错误 ----在呈现模板期间抛出异常 ("Unable to generate a URL for the named route "myBundle_publisher" 就像这样的路由一样不存在。”)

我阅读了 twig 文档,它也像我写的那样写。

有谁知道我该如何解决这个问题。真的堆到这里,谁能解决这个问题,先谢谢了。

需要导入路由才能像任何其他路由资源一样激活(注意注释类型):

# import routes from a controller class
post:
    resource: "@SensioBlogBundle/Controller/PostController.php"
    type:     annotation

有关@Route

的更多信息