我正在開發一個使用Symfony 2.4和學說mongodb包的應用程序。我面臨一個惱人的錯誤說:ClassNotFoundException:試圖從命名空間加載類「FlattenException」
ClassNotFoundException的:試圖加載類 「FlattenException」 從命名空間中的/ opt /應用/ AFF /供應商/學說 「的Symfony \分量\調試\異常」/ MongoDB的-ODM/lib/Doctrine/ODM/MongoDB/Cursor.php第455行。你是否需要從另一個命名空間「使用」它?也許您需要爲以下某個添加使用語句:Symfony \ Component \ HttpKernel \ Exception \ FlattenException,Symfony \ Component \ Debug \ Exception \ FlattenException。
當訪問奏鳴曲管理包的列表方法時,會發生此錯誤。在播放存儲庫分類時,我也遇到了這個錯誤。
確切的代碼在遠程服務器上運行完美。但是在本地機器上發生這個錯誤。我不知道爲什麼。我在終端上運行以下代碼以查看版本號或git commit ref代碼。
$ php composer.phar show -i
結果在兩臺計算機上都是完全相同的。下面是我的composer.json
{
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-0": { "": "src/" }
},
"require": {
"php": ">=5.3.3",
"symfony/symfony": "~2.4",
"twig/extensions": "~1.0",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~2.3",
"sensio/framework-extra-bundle": "~2.3",
"sensio/generator-bundle": "~2.3",
"incenteev/composer-parameter-handler": "~2.0",
"doctrine/mongodb-odm": "1.0.*@dev",
"doctrine/mongodb-odm-bundle": "3.0.*@dev",
"doctrine/doctrine-fixtures-bundle": "dev-master",
"gedmo/doctrine-extensions": "dev-master",
"jms/serializer-bundle" : "dev-master",
"friendsofsymfony/user-bundle": "*",
"friendsofsymfony/facebook-bundle": "1.2.*@dev",
"friendsofsymfony/rest-bundle" : "dev-master",
"nelmio/api-doc-bundle" : "dev-master",
"sonata-project/core-bundle": "[email protected]",
"sonata-project/admin-bundle": "2.2.*@dev",
"sonata-project/doctrine-mongodb-admin-bundle":"dev-master",
"sonata-project/block-bundle": "2.2.*@dev",
"sonata-project/user-bundle": "2.2.3",
"sonata-project/easy-extends-bundle" : "dev-master",
"sonata-project/intl-bundle": "dev-master",
"knplabs/knp-menu-bundle":"1.1.x-dev",
"zeitnot/cp_oauth_client" : "dev-master"
},
"scripts": {
"post-install-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
],
"post-update-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"php app/console assets:install --symlink",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
]
},
"config": {
"bin-dir": "bin"
},
"minimum-stability": "beta",
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"incenteev-parameters": {
"file": "app/config/parameters.yml",
"keep-outdated": true
},
"branch-alias": {
"dev-master": "2.4-dev"
}
}
}
我真的很迷茫,我不知道該怎麼procceed。這個惱人的例外是什麼意思?
謝謝!正如你所說,我已經這樣做了。它確實有效。這是一個無聊的問題。 – zeitnot