1

我已经使用一些 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"
    }
}
4

1 回答 1

2

您可以在AbstractDoctrineExtension中查看导致此问题的原因。如您所见,此错误与您在配置文件中定义的映射有关。

It is also mentioned here that this error is triggered by an error in the mappings, just try to comment out what you have in the mappings.

orm:
    auto_generate_proxy_classes: %kernel.debug%
    default_entity_manager: default
    entity_managers:
        default:
            mappings:
                #whatever you have here
于 2013-08-28T05:08:06.310 回答