2013-08-27 39 views
1

我已經使用一些Symfony2組件和Doctrine構建了一個庫。我現在想在Symfony2控制檯應用程序中使用這個庫。我已經包括通過作曲家作爲供應商我的圖書館,但是,我發現了以下錯誤,當我執行我的庫代碼:Symfony2'Bundle「默認」不存在'

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有關或者如何開始調試。

任何幫助非常感謝。

UPDATE:

這是Composer.json我的控制檯應用程序:

{ 
    "name": "my/console", 
    "type": "application", 
    "repositories": [ 
     { 
      "type": "vcs", 
      "url": "[email protected]: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

我們可以看到你的'composer.json'文件嗎? – Mick

回答

1

你可以看到在AbstractDoctrineExtension中造成這種情況的原因是什麼。如您所見,此錯誤與您在配置文件中定義的映射有關。

它也被提到here這個錯誤是由映射中的錯誤觸發的,只是試圖註釋你映射中的內容。

orm: 
    auto_generate_proxy_classes: %kernel.debug% 
    default_entity_manager: default 
    entity_managers: 
     default: 
      mappings: 
       #whatever you have here 
+0

如果這不起作用,請發佈您的配置文件(只是orm部分)。 – Mick

+0

感謝您指點我正確的方向!問題在於我的實體在圖書館開發環境中的位置與用作實際圖書館的位置不同(在這種情況下,它們位於供應商目錄內)。 – Luke

+0

只是想添加到我的上面的評論,我通過使用我的Doctrine實體位置可以通過parameters.yml配置,以便在不同的環境中,他們可以位於不同的目錄中。 – Luke