Symfony2 FOSUSER无效资源

时间:2016-03-21 12:28:06

标签: php symfony yaml fosuserbundle

我正在尝试在我的新symfony2项目(v2.8)上设置一个简单的FOSUser实例。我完全按照文档中的说明进行了操作。我得到了当前的错误

    InvalidConfigurationException in ArrayNode.php line 317:
Unrecognized option "resource" under "fos_user"
in ArrayNode.php line 317
at ArrayNode->normalizeValue(array('db_driver' => 'orm', 'firewall_name' => 'main', 'user_class' => 'AuthBundle\Entity\User', 'resource' => '@FOSUserBundle\Resources\config outingll.xml')) in BaseNode.php line 264
at BaseNode->normalize(array('db_driver' => 'orm', 'firewall_name' => 'main', 'user_class' => 'AuthBundle\Entity\User', 'resource' => '@FOSUserBundle\Resources\config outingll.xml')) in Processor.php line 33
at Processor->process(object(ArrayNode), array(array('db_driver' => 'orm', 'firewall_name' => 'main', 'user_class' => 'AuthBundle\Entity\User', 'resource' => '@FOSUserBundle\Resources\config outingll.xml'))) in Processor.php line 50
at Processor->processConfiguration(object(Configuration), array(array('db_driver' => 'orm', 'firewall_name' => 'main', 'user_class' => 'AuthBundle\Entity\User', 'resource' => '@FOSUserBundle\Resources\config outingll.xml'))) in FOSUserExtension.php line 45
at FOSUserExtension->load(array(array('db_driver' => 'orm', 'firewall_name' => 'main', 'user_class' => 'AuthBundle\Entity\User', 'resource' => '@FOSUserBundle\Resources\config outingll.xml')), object(ContainerBuilder)) in MergeExtensionConfigurationPass.php line 55
at MergeExtensionConfigurationPass->process(object(ContainerBuilder)) in MergeExtensionConfigurationPass.php line 39
at MergeExtensionConfigurationPass->process(object(ContainerBuilder)) in Compiler.php line 107
at Compiler->compile(object(ContainerBuilder)) in ContainerBuilder.php line 593
at ContainerBuilder->compile() in Kernel.php line 511
at Kernel->initializeContainer() in Kernel.php line 133
at Kernel->boot() in Kernel.php line 182
at Kernel->handle(object(Request)) in app_dev.php line 30
at require('/home/sergio/Desktop/RSU/web/app_dev.php') in router_dev.php line 40

在config.yml我得到了当前的标识

    # fos
fos_user:
    db_driver: orm # other valid values are 'mongodb', 'couchdb' and 'propel'
    firewall_name: main
    user_class: AuthBundle\Entity\User
    resource: "@FOSUserBundle\Resources\config\routing\all.xml"

一切都在教程中,我评论了“资源”部分,我可以更新数据库架构,symfony无法找到它接缝的FOSUserBundle \ Resources \ config \ routing \ all.xml。任何建议如何解决这个问题?

谢谢。

1 个答案:

答案 0 :(得分:1)

您需要将资源键放在routing.yml

中的fos_user下
# app/config/routing.yml
fos_user:
    resource: "@FOSUserBundle/Resources/config/routing/all.xml"

<强>文档

Jsfiddle