Symfony路由文件中的type:
配置控制什么?有效值是多少?
我在任何地方都找不到明确记录的配置字段。在Symfony的routing documentation中间接引用了它。
app_directory:
resource: '../legacy/routing/'
type: directory
,似乎与加载其他路线有关。但是,似乎没有在任何地方明确定义其行为(或其所有允许的值)。我可以猜测它以某种方式告诉Symfony 如何加载外部路由,但是我很想知道
directory
或annotation
以外的有效值?答案 0 :(得分:1)
您可以在Symfony documentation中找到该类型的工作方式,请参见下面的代码。它控制是否应从PHP注释或该(捆绑)目录中的YAML或XML文件加载路由。
app_file:
# loads routes from the given routing file stored in some bundle
resource: '@AcmeOtherBundle/Resources/config/routing.yaml'
app_annotations:
# loads routes from the PHP annotations of the controllers found in that directory
resource: '../src/Controller/'
type: annotation
app_directory:
# loads routes from the YAML or XML files found in that directory
resource: '../legacy/routing/'
type: directory
app_bundle:
# loads routes from the YAML or XML files found in some bundle directory
resource: '@AppBundle/Resources/config/routing/public/'
type: directory