Skip to content

--em option no longer supported in doctrine:migrations:diff #14101

@marcelkorpel

Description

@marcelkorpel

Symfony version(s) affected: 5.1.3

Description
According to https://symfony.com/doc/current/doctrine/multiple_entity_managers.html one can work with multiple entity managers and issue a command like

$ php bin/console doctrine:migrations:diff --em=customer

to select a different entity manager, as configured in config/packages/doctrine.yaml. This worked a year ago with Symfony 4. Currently, this command outputs


  The "--em" option does not exist.  
                                     

doctrine:migrations:diff [--configuration CONFIGURATION] [--db-configuration DB-CONFIGURATION] [--namespace NAMESPACE] [--filter-expression FILTER-EXPRESSION] [--formatted] [--line-length LINE-LENGTH] [--check-database-platform [CHECK-DATABASE-PLATFORM]] [--allow-empty-diff] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command>

The same is true for doctrine:migrations:migrate.

How to reproduce

# config/packages/doctrine.yaml
doctrine:
    dbal:
        connections:
            user:
                driver: 'pdo_mysql'
                server_version: '5.7'
                charset: utf8mb4
                default_table_options:
                    charset: utf8mb4
                    collate: utf8mb4_unicode_ci
                url: '%env(resolve:DATABASE_URL_USER)%'

        # IMPORTANT: You MUST configure your server version,
        # either here or in the DATABASE_URL env var (see .env file)
        #server_version: '5.7'
    orm:
        auto_generate_proxy_classes: true
        default_entity_manager: user
        entity_managers:
            user:
                connection: user
                mappings:
                    User:
                        is_bundle: false
                        type: annotation
                        dir: '%kernel.project_dir%/src/Entity/User'
                        prefix: 'App\Entity\User'
                        alias: User
# config/packages/doctrine_migrations.yaml
doctrine_migrations:
    connection: user
    migrations_paths:
        # namespace is arbitrary but should be different from App\Migrations
        # as migrations classes should NOT be autoloaded
        'DoctrineMigrations': '%kernel.project_dir%/migrations'
# config-migrations/doctrine_migrations_user.yaml
name: UserMigrations
migrations_namespace: App\Migrations\User
table_name: Migrations
migrations_directory: src/Migrations/User

Run

$ bin/console doctrine:migrations:diff --em=user --configuration=config-migrations/doctrine_migrations_user.yaml

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions