services:
    _instanceof:
        Claroline\MigrationBundle\Command\AbstractCommand:
            calls:
                - [setManager, ['@claroline.migration.manager']]

    claroline.migration.manager:
        class: Claroline\MigrationBundle\Manager\Manager
        arguments:
            - '@claroline.migration.generator'
            - '@claroline.migration.writer'
            - '@claroline.migration.migrator'
        calls:
            - [ setLogger, [ '@logger' ] ]

    claroline.migration.generator:
        class: Claroline\MigrationBundle\Generator\Generator
        arguments:
            - '@doctrine.orm.entity_manager'
            - '@claroline.migration.doctrine_schema_tool'

    claroline.migration.writer:
        class: Claroline\MigrationBundle\Generator\Writer
        arguments:
            - '@filesystem'
            - '@twig'

    claroline.migration.migrator:
        class: Claroline\MigrationBundle\Migrator\Migrator
        arguments:
            - '@doctrine.dbal.default_connection'

    claroline.migration.doctrine_schema_tool:
        class: Doctrine\ORM\Tools\SchemaTool
        arguments:
            - '@doctrine.orm.entity_manager'


    # Console commands

    Claroline\MigrationBundle\Command\DiscardCommand:
        tags:
            - { name: 'console.command', command: 'claroline:migration:discard' }

    Claroline\MigrationBundle\Command\DowngradeCommand:
        tags:
            - { name: 'console.command', command: 'claroline:migration:downgrade' }

    Claroline\MigrationBundle\Command\GenerateCommand:
        tags:
            - { name: 'console.command', command: 'claroline:migration:generate' }

    Claroline\MigrationBundle\Command\ReplaceCommand:
        tags:
            - { name: 'console.command', command: 'claroline:migration:replace' }

    Claroline\MigrationBundle\Command\UpgradeCommand:
        tags:
            - { name: 'console.command', command: 'claroline:migration:upgrade' }

    Claroline\MigrationBundle\Command\VersionCommand:
        arguments:
            - '@claroline.migration.migrator'
        tags:
            - { name: 'console.command', command: 'claroline:migration:version' }
