10

通过composer.json安装symfony2和mongodb后(安装成功)。但是,当我执行应用程序时,我收到以下错误消息:

InvalidArgumentException: Unable to replace alias "doctrine_mongodb.odm.document_manager" with "doctrine.odm.mongodb.document_manager".

这是我的composer.json:

"require": {
    "php": ">=5.3.3",
    "symfony/symfony": "2.2.*",
    "doctrine/orm": "~2.2,>=2.2.3",
    "doctrine/doctrine-bundle": "1.2.*",
    "twig/extensions": "1.0.*",
    "symfony/assetic-bundle": "2.1.*",
    "symfony/swiftmailer-bundle": "2.2.*",
    "symfony/monolog-bundle": "2.2.*",
    "sensio/distribution-bundle": "2.2.*",
    "sensio/framework-extra-bundle": "2.2.*",
    "sensio/generator-bundle": "2.2.*",
    "jms/security-extra-bundle": "1.4.*",
    "jms/di-extra-bundle": "1.3.*",
    "doctrine/mongodb-odm-bundle": "3.0.*"
},

有人有想法吗?

4

2 回答 2

23

您必须将教义 mongodb 配置添加到app/config/config.yml

doctrine_mongodb:
    connections:
        default:
            server: mongodb://localhost:27017
            options: {}
    default_database: kickass
    document_managers:
        default:
            auto_mapping: true
于 2013-05-01T14:58:57.363 回答
0

您的 composer.json 还应该包含以下这一行,以安装实际的 ODM 库。这将解决您的问题

"doctrine/mongodb-odm": "1.0.*@dev",
于 2013-04-24T15:15:12.677 回答