简体   繁体   English

symfony4:没有能够加载“doctrine_mongodb”配置的扩展

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

I have an issue to configure doctrine odm with Symfony4.1我在使用 Symfony4.1 配置学说 odm 时遇到问题

I got an error message on composer update, cache:clear subcommand我收到关于 composer update, cache:clear 子命令的错误消息

There is no extension able to load the configuration for "doctrine_mongodb" (in /home/thomas/Documents/dev/blade/vm_api/config/packages/doctrine.yaml).没有扩展能够加载“doctrine_mongodb”的配置(在/home/thomas/Documents/dev/blade/vm_api/config/packages/doctrine.yaml)。 Looked for namespace "doctrine_mongodb", found "framework"寻找命名空间“doctrine_mongodb”,找到“framework”

My composer.json look ok我的 composer.json 看起来不错

    {
    "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我是 4.1 的新手,也许我做错了什么

Thanks in advance提前致谢

Your bundle should be automatically enabled if you use Flex.如果您使用 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 文件中添加以下行来手动启用包

// config/bundles.php
<?php

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM