symfony4: There is no extension able to load the configuration for "doctrine_mongodb"

3.7k Views Asked by At

I have an issue to configure doctrine odm with Symfony4.1

I got an error message on composer update, cache:clear subcommand

There is no extension able to load the configuration for "doctrine_mongodb" (in /home/thomas/Documents/dev/blade/vm_api/config/packages/doctrine.yaml). Looked for namespace "doctrine_mongodb", found "framework"

My composer.json look ok

    {
    "type": "project",
    "license": "proprietary",
    "require": {
        "php": "^7.1.3",
        "ext-ctype": "*",
        "ext-iconv": "*",
        "alcaeus/mongo-php-adapter": "^1.1.5",
        "doctrine/mongodb-odm": "^1.2.4",
        "doctrine/mongodb-odm-bundle": "^3.5",
        "mongodb/mongodb": "1.3.2",
        "symfony/console": "*",
        "symfony/flex": "^1.1",
        "symfony/framework-bundle": "*",
        "symfony/yaml": "*"
    },
    "require-dev": {
        "symfony/dotenv": "*"
    },
    "config": {
        "preferred-install": {
            "*": "dist"
        },
        "sort-packages": true
    },
    "autoload": {
        "psr-4": {
            "App\\": "src/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "App\\Tests\\": "tests/"
        }
    },
    "replace": {
        "paragonie/random_compat": "*",
        "symfony/polyfill-ctype": "*",
        "symfony/polyfill-iconv": "*",
        "symfony/polyfill-php71": "*",
        "symfony/polyfill-php70": "*",
        "symfony/polyfill-php56": "*",
        "symfony/symfony": "*"
    },
    "scripts": {
        "auto-scripts": {
            "cache:clear": "symfony-cmd",
            "assets:install %PUBLIC_DIR%": "symfony-cmd"
        },
        "post-install-cmd": [
            "@auto-scripts"
        ],
        "post-update-cmd": [
            "@auto-scripts"
        ]
    },
    "conflict": {
        "symfony/symfony": "*"
    }
}

And the configuration file is with the "normal" parameters

parameters:
    # Adds a fallback DATABASE_URL if the env var is not set.
    # This allows you to run cache:warmup even if your
    # environment variables are not available yet.
    # You should not need to change this value.
    env(DATABASE_URL): ''

doctrine_mongodb:
  #default_commit_options: ~
  default_database: "%env(DATABASE_NAME)%"
  connections:
    default:
      server: "%env(DATABASE_HOST)%"
      options:
        username: "%env(DATABASE_USER)%"
        password: "%env(DATABASE_PASSWORD)%"
        authSource: "%env(DATABASE_AUTH_SOURCE)%"
        ssl: "%env(DATABASE_SSL%"
        replicaSet: "%env(DATABASE_REPLICA_SET)%"
  document_managers:
    default:
      mappings:
        DocumentBundle:
          type: annotation
          dir: Document/

I'am new with 4.1, and maybe I did something wrong

Thanks in advance

1

There are 1 best solutions below

0
On

Your bundle should be automatically enabled if you use Flex. Otherwise, you'll need to manually enable the bundle by adding the following line in the config/bundles.php file of your project

// config/bundles.php
<?php

return [
    // ...
    Doctrine\Bundle\MongoDBBundle\DoctrineMongoDBBundle::class => ['all' => true],
];