symfony 2.3无法集成FosUserBundle库

时间:2015-04-06 10:14:08

标签: symfony fosuserbundle symfony-2.3

我试图在我的symfony项目中使用Fosuser库来获取Windows环境下的身份验证系统。我关注了documentationtutorial。  在第六步之后,我尝试执行app/console router:debug,但是我收到了这个错误:

 [Symfony\Component\DependencyInjection\Exception\InvalidArgumentException]   
 There is no extension able to load the configuration for "fos_user" (in C:\  
 wamp\www\new_project\app/config\config.yml). Looked for namespace "  
 fos_user", found "framework", "security", "twig", "monolog", "swiftmailer",  
 "assetic", "doctrine", "sensio_framework_extra", "user", "acme_demo", "web  
_profiler", "sensio_distribution"  

这是我的app / config.yml:

imports:
- { resource: parameters.yml }
- { resource: security.yml } 

framework:
#esi:             ~
#translator:      { fallback: "%locale%" }
translator: ~
secret:          "%secret%"
router:
    resource: "%kernel.root_dir%/config/routing.yml"
    strict_requirements: ~
form:            ~
csrf_protection: ~
validation:      { enable_annotations: true }
templating:
    engines: ['twig']
    #assets_version: SomeVersionScheme
default_locale:  "%locale%"
trusted_proxies: ~
session:         ~
fragments:       ~
http_method_override: true

# Twig Configuration
twig:
debug:            "%kernel.debug%"
strict_variables: "%kernel.debug%"

# Assetic Configuration
assetic:
debug:          "%kernel.debug%"
use_controller: false
bundles:        [ ]
#java: /usr/bin/java
filters:
    cssrewrite: ~
    #closure:
    #    jar: "%kernel.root_dir%/Resources/java/compiler.jar"
    #yui_css:
    #    jar: "%kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar"

 # Doctrine Configuration
doctrine:
dbal:
    driver:   "%database_driver%"
    host:     "%database_host%"
    port:     "%database_port%"
    dbname:   "%database_name%"
    user:     "%database_user%"
    password: "%database_password%"
    charset:  UTF8
    # if using pdo_sqlite as your database driver:
    #   1. add the path in parameters.yml
    #     e.g. database_path: "%kernel.root_dir%/data/data.db3"
    #   2. Uncomment database_path in parameters.yml.dist
    #   3. Uncomment next line:
    #     path:     "%database_path%"

orm:
    auto_generate_proxy_classes: "%kernel.debug%"
    auto_mapping: true

  # Swiftmailer Configuration
swiftmailer:
transport: "%mailer_transport%"
host:      "%mailer_host%"
username:  "%mailer_user%"
password:  "%mailer_password%"
spool:     { type: memory }

# Fos_user Configuration
fos_user:
db_driver: orm # other valid values are 'mongodb', 'couchdb' and 'propel'
firewall_name: main
user_class: User\UserBundle\Entity\User

知道如何解决这个问题吗?

1 个答案:

答案 0 :(得分:0)

正如他们在评论中提到的那样,我在AppKernel.php中没有添加捆绑包时犯了一个错误。实际上我添加了它并对其进行了评论,因为我还没有完成库安装过程。 当我在AppKernel.php中添加此行时: new FOS\UserBundle\FOSUserBundle()
问题解决了。