Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doctrine MongoDB Manager named "default_document_manager" does not exist. #32

Closed
graillus opened this issue Apr 8, 2020 · 1 comment · Fixed by #33
Closed

Doctrine MongoDB Manager named "default_document_manager" does not exist. #32

graillus opened this issue Apr 8, 2020 · 1 comment · Fixed by #33

Comments

@graillus
Copy link
Contributor

graillus commented Apr 8, 2020

Since I upgraded from 2.0.1 to 3.0.0, I get the following error:

bin/console doctrine:migrations:migrate -n
In AbstractManagerRegistry.php line 151:

Doctrine MongoDB Manager named "default_document_manager" does not exist.

mongodb:migrations:migrate [--configuration [CONFIGURATION]] [--db-configuration [DB-CONFIGURATION]] [--dm [DM]] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command> [<version>]

Looks like the bundle is tries to retrieve the default_document_manager when the command-line option --dm is not provided.

Before the upgrade, the same command with same configuration worked fine. I tested to upgrade to symfony 5, but didn't help.

Bundles installed

doesntmattr/mongodb-migrations-bundle: 3.0.0
doctrine/mongodb-odm: 2.0.5
doctrine/mongodb-odm-bundle: 4.1.1
symfony: 4.4

Bundles configuration

doesntmattr/mongodb-migrations-bundle configuration:

mongo_db_migrations:
    collection_name: 'migration_versions'
    database_name: '%env(MONGODB_DB)%'
    dir_name: '%kernel.root_dir%/Migration/'
    script_dir_name: '%kernel.root_dir%/scripts'
    name: 'MongoDB Migrations'
    namespace: 'App\Migration'

doctrine/mongodb-odm-bundle configuration:

doctrine_mongodb:
    auto_generate_proxy_classes: true
    auto_generate_hydrator_classes: true
    connections:
        default:
            server: '%env(MONGODB_URL)%'
            options: {}
    default_database: '%env(MONGODB_DB)%'
    document_managers:
        default:
            auto_mapping: true
            mappings:
                App:
                    is_bundle: false
                    type: annotation
                    dir: '%kernel.project_dir%/src/Document'
                    prefix: 'App\Document'
                    alias: App

I don't think the issue comes from my configuration, but rather from the fact that the bundle tries to get the default_document_manager document manager by default. But it doesn't exist, the default manager is named default.

IMO the bundle should not be responsible for choosing the name of the default document manager, the ManagerRegistry::getManager($name) does the job when called with null

I will open a PR to fix this behaviour

Thanks

@arendjantetteroo
Copy link
Contributor

arendjantetteroo commented Apr 30, 2020

Caused by/changed in 73a7366

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants