我想用MongoDb数据库安装SonataUserBundle, 这是我的配置文件:
我的config.yml
fos_user:
db_driver: mongodb
firewall_name: main
user_class: Sonata\UserBundle\Document\BaseUser
group:
group_class: Sonata\UserBundle\Document\BaseGroup
group_manager: sonata.user.mongodb.user_manager
service:
user_manager: sonata.user.mongodb.group_manager
sonata_user:
security_acl: true
manager_type: mongodb # can be orm or mongodb
sonata_admin:
title: Admin
#title_logo: bundles/acmedemo/img/fancy_acme_logo.png
我的AppKernel.php
//knp
new Knp\Bundle\MarkdownBundle\KnpMarkdownBundle(),
new Knp\Bundle\MenuBundle\KnpMenuBundle(),
//fos
new FOS\ElasticaBundle\FOSElasticaBundle(),
new FOS\UserBundle\FOSUserBundle(),
//mongo
new Doctrine\Bundle\MongoDBBundle\DoctrineMongoDBBundle(),
//sonata
new Sonata\FormatterBundle\SonataFormatterBundle(),
new Sonata\DoctrineMongoDBAdminBundle\SonataDoctrineMongoDBAdminBundle(),
new Sonata\AdminBundle\SonataAdminBundle(),
new Sonata\CoreBundle\SonataCoreBundle(),
new Sonata\BlockBundle\SonataBlockBundle(),
new Sonata\UserBundle\SonataUserBundle(),
new Sonata\EasyExtendsBundle\SonataEasyExtendsBundle(),
我的composer.json
"sonata-project/doctrine-mongodb-admin-bundle": "2.3.0",
"doctrine/mongodb-odm-bundle": "3.0.*@dev",
"doctrine/mongodb-odm": "1.0.*@dev",
"doctrine/doctrine-fixtures-bundle": "~2.2.0@dev",
"sonata-project/user-bundle": "2.3.*@dev",
"sonata-project/datagrid-bundle": "2.2.*@dev",
"sonata-project/formatter-bundle": "~2.3",
"friendsofsymfony/elastica-bundle": "~3.0",
"sonata-project/doctrine-orm-admin-bundle": "2.4.*@dev"
My Security.yml
security:
acl:
connection: default
role_hierarchy:
ROLE_ADMIN: [ROLE_USER, ROLE_SONATA_ADMIN]
ROLE_SUPER_ADMIN: [ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
SONATA:
- ROLE_SONATA_PAGE_ADMIN_PAGE_EDIT # if you are using acl then this line must be commented
providers:
fos_userbundle:
id: fos_user.user_manager
firewalls:
# Disabling the security for the web debug toolbar, the profiler and Assetic.
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
# -> custom firewall for the admin area of the URL
admin:
pattern: /admin(.*)
context: user
form_login:
provider: fos_userbundle
login_path: /admin/login
use_forward: false
check_path: /admin/login_check
failure_path: null
logout:
path: /admin/logout
anonymous: true
# -> end custom configuration
# default login area for standard users
# This firewall is used to handle the public login area
# This part is handled by the FOS User Bundle
main:
pattern: .*
context: user
form_login:
provider: fos_userbundle
login_path: /login
use_forward: false
check_path: /login_check
failure_path: null
logout: true
anonymous: true
我一直有这个例外
服务" sonata.user.serializer.handler.user"依赖于 一个不存在的服务" sonata.user.manager.user"。
请帮助。