CommandSubscriber not found after upgrading symfony version 3.4 to 6.2

1k Views Asked by At

I have upgrade symfony version from 3.4 to 6.2 and mostly it's working but after attaching MongoDB I'm getting this error.

Class "MongoDB\Driver\Monitoring\CommandSubscriber" not found while loading "Doctrine\Bundle\MongoDBBundle\APM\StopwatchCommandLogger".

Here is the visual of the error

Where I am making mistakes ? Much thanks in advance.

here is my composer.json content

{
    "name": "symfony/framework-standard-edition",
    "description": "The \"Symfony Standard Edition\" distribution",
    "autoload": {
        "psr-4": {
            "App\\": "src/"
        }
    },
    "require": {
        "php": ">=8.0",
        "ext-curl": "*",
        "ext-json": "*",
        "ext-mongodb": "*",
        "alcaeus/mongo-php-adapter": "1.2.2",
        "api-platform/core": "^3.2@dev",
        "aws/aws-sdk-php": "^3.209",
        "beberlei/doctrineextensions": "@stable",
        "doctrine/doctrine-fixtures-bundle": "3.4.2",
        "doctrine/doctrine-migrations-bundle": "3.3.x-dev",
        "doctrine/mongodb-odm": "2.6.x-dev",
        "doctrine/mongodb-odm-bundle": "4.6.x-dev",
        "doctrine/orm": "^2.5",
        "friendsofsymfony/rest-bundle": "3.3.*",
        "guzzlehttp/guzzle": "@stable",
        "jms/serializer-bundle": "^3.9",
        "nelmio/api-doc-bundle": "4.8.*",
        "nelmio/cors-bundle": "^2.2",
        "predis/predis": "^1.1",
        "sensio/framework-extra-bundle": "^6.1",
        "sinner/phpseclib-bundle": "dev-master",
        "symfony/dependency-injection": "6.3.x-dev",
        "symfony/dotenv": "v6.2.0",
        "symfony/framework-bundle": "6.2.x-dev",
        "symfony/mailer": "6.2.7",
        "symfony/monolog-bundle": "^3.1.0",
        "symfony/polyfill-apcu": "^1.0",
        "symfony/security-bundle": "6.3.x-dev",
        "symfony/twig-bundle": "6.3.x-dev",
        "symfony/validator": "6.3.x-dev",
        "twig/extensions": "^1.3",
        "twig/twig": "^1.0||^2.0",
        "willdurand/geocoder-bundle": "@stable"
    },
    "require-dev": {
        "symfony/phpunit-bridge": "^3.0"
    },
    "scripts": {
        "symfony-scripts": [
            "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": [
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
        ]
    },
    "config": {
        "optimize-autoloader": true,
        "process-timeout":  600,
        "preferred-install": {
            "*": "dist"
        },
        "sort-packages": true,
        "allow-plugins": {
            "symfony/flex": true,
            "php-http/discovery": true
        }
    },
    "provide": {
        "ext-mongo": "*",
        "ext-mongodb": "*"
    },
    "minimum-stability": "dev",
    "extra": {
        "symfony-app-dir": "app",
        "symfony-bin-dir": "bin",
        "symfony-var-dir": "var",
        "symfony-web-dir": "web",
        "symfony-tests-dir": "tests",
        "branch-alias": {
            "dev-master": "3.4.x-dev"
        }
    }
}

I did 3 to 4 hours googling but couldn't find any solution so I thought I should post it on stack overflow so I can get answers from the community.

1

There are 1 best solutions below

1
Adrian Hontau On

Are you trying to do a composer install with '--ignore-platform-reqs' flag? My assumption is that the package 'doctrine/mongodb-odm' is skipped because you do not have installed and enabled the 'ext-mongodb' php extension.

Could you try running the composer install without '--ignore-platform-reqs' flag?