在config.yml中定义MongoDB的正确方法 [英] Right way to define MongoDB in config.yml
问题描述
我在项目中使用MongoDB,但显然Doctrine更新了它们的捆绑包,现在如果我运行 composer update命令,就会遇到问题。这是我的doctrine.yml文件:
I'm using MongoDB in my project but apparently Doctrine update their bundle and now I'm having issues if I run "composer update" command. This is my doctrine.yml file:
# ODM
doctrine_odm.mongodb:
connections:
default:
server: mongodb://%mongo_host%:%mongo_port%
options: {}
default_database: %mongo_database%
document_managers:
default:
auto_mapping: true
但我收到此错误:
[Symfony\组件\DependencyInjection\Exception\InvalidArgumentException]
没有扩展能够加载
doctrine_odm的配置。 mongodb(在
/var/www/html/kraken/app/config/doctrine.yml中)。
[Symfony\Component\DependencyInjection\Exception\InvalidArgumentException] There is no extension able to load the configuration for "doctrine_odm.mongodb" (in /var/www/html/kraken/app/config/doctrine.yml).
如果我使用其他配置:
# ODM
doctrine_mongodb:
connections:
default:
server: mongodb://%mongo_host%:%mongo_port%
options: {}
default_database: %mongo_database%
document_managers:
default:
auto_mapping: true
然后将错误转换为此:
[Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException]
服务 doctrine_mongodb.odm.default_configuration对非现有参数
doctrine_mongodb.odm.default_commit_options。您是说
的意思之一: doctrine_mongodb.odm.default_connection,
doctrine_mongodb.odm.default_document_manager吗?
[Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException] The service "doctrine_mongodb.odm.default_configuration" has a dependency on a non-existent parameter "doctrine_mongodb.odm.default_commit_options". Did you mean one of these: "doctrine_mongodb.odm.default_connection", "doctrine_mongodb.odm.default_document_manager"?
我在做错什么或丢失什么?
What I'm doing wrong or what I'm missing?
推荐答案
只需添加(我有相同的几分钟前我运行作曲家更新时出现问题):
Just add (I have had the same problem few minutes ago when I ran composer update):
doctrine_mongodb:
default_commit_options: ~
这篇关于在config.yml中定义MongoDB的正确方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!