我使用一些Symfony2组件和Doctrine构建了一个库。我现在想在Symfony2控制台应用程序中使用此库。我通过Composer作为供应商包含了我的库,但是,当我执行库代码时出现以下错误:
PHP Fatal error: Uncaught exception 'InvalidArgumentException' with message 'Bundle "default" does not exist or it is not enabled.' in /home/user/project/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php:90
我不确定“默认”捆绑包是什么,如何与Doctrine或如何开始调试它。
任何帮助都非常感激。
更新
这是我的控制台应用程序的Composer.json:
{
"name": "my/console",
"type": "application",
"repositories": [
{
"type": "vcs",
"url": "git@bitbucket.org:my/library.git"
}
],
"require": {
"php": ">=5.3.3",
"my/library": "dev-dev-master"
},
"autoload": {
"psr-0": {
"My\\": ["src/"]
}
}
}
这是我的库的Composer.json:
{
"name": "my/library",
"type": "library",
"keywords": [
"my", "library"
],
"homepage": "https://www.mine.com/",
"autoload": {
"psr-0": { "My\\": ["src/"] }
},
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.3.*",
"doctrine/orm": "2.3.*",
"doctrine/doctrine-bundle": "1.2.*",
"twig/extensions": "1.0.*",
"symfony/swiftmailer-bundle": "2.3.*",
"symfony/monolog-bundle": "2.3.*",
"sensio/distribution-bundle": "2.3.*",
"sensio/framework-extra-bundle": "2.3.*",
"sensio/generator-bundle": "2.3.*",
"underscore/underscore.php": "1.3.1",
"sami/sami": "v1.1"
},
"scripts": {
"post-install-cmd": [
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache"
],
"post-update-cmd": [
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache"
]
},
"config": {
"bin-dir": "bin"
},
"minimum-stability": "stable",
"extra": {
"symfony-app-dir": "app"
}
}
答案 0 :(得分:1)
您可以在AbstractDoctrineExtension中查看导致此问题的原因。如您所见,此错误与您在配置文件中定义的映射有关。
还提到here此错误是由映射中的错误触发的,只是尝试注释掉映射中的内容。
orm:
auto_generate_proxy_classes: %kernel.debug%
default_entity_manager: default
entity_managers:
default:
mappings:
#whatever you have here