3

I am developing an application using Symfony 2.4 and doctrine mongodb bundle. I have faced an annoying error saying:

ClassNotFoundException: Attempted to load class "FlattenException" from namespace "Symfony\Component\Debug\Exception" in /opt/apps/aff/vendor/doctrine/mongodb-odm/lib/Doctrine/ODM/MongoDB/Cursor.php line 455. Do you need to "use" it from another namespace? Perhaps you need to add a use statement for one of the following: Symfony\Component\HttpKernel\Exception\FlattenException, Symfony\Component\Debug\Exception\FlattenException.

This error occurs especially when visiting sonata admin bundle's list methods. I have faced with this error also when playing repository classess.

The exact code is running perfectly on the remote server. But on the local machine this error is occuring. I do not know why. I have run the following code on terminal to see version numbers or git commit ref codes.

$ php composer.phar show -i

The result is axactly same on both computers. The following is my 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": "~2.2@dev",
    "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"
    }
}

}

I am really confused and I do not know how to procceed. What is the meaning of this annoying exception?

1 Answer 1

2

I had the same thing, the error was forced by a wrong parameter type in the hint() method in Cursor.php. And the PHP strict standards error setting of PHP is creating an error for that. That might be the reason it was working fine on the remote server (different PHP settings).

The problem is solved now, so updating your MongoDB vendors should fix it. More information

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks! I have already done that as you said. It did work. That was a boring issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.