services:
    oro_entity_merge.mass_action.iterable_result_factory:
        class: Oro\Bundle\EntityMergeBundle\DataGrid\Extension\MassAction\MergeIterableResultFactory
        parent: oro_datagrid.extension.mass_action.iterable_result_factory

    oro_entity_merge.mass_action.merge:
        class: Oro\Bundle\EntityMergeBundle\DataGrid\Extension\MassAction\MergeMassAction
        arguments:
            - '@oro_entity_config.provider.merge'
        shared: false
        tags:
            - { name: oro_datagrid.extension.mass_action.type, type: merge }

    oro_entity_merge.mass_action.iterable_result_factory_registry:
        class: Oro\Bundle\DataGridBundle\Extension\MassAction\IterableResultFactoryRegistry
        arguments:
            - ['@oro_entity_merge.mass_action.iterable_result_factory']

    oro_entity_merge.mass_action.dispatcher:
        class: Oro\Bundle\DataGridBundle\Extension\MassAction\MassActionDispatcher
        arguments:
            - '@oro_datagrid.datagrid.manager'
            - '@oro_datagrid.mass_action.helper'
            - '@oro_datagrid.mass_action.parameters_parser'
            - '@oro_entity_merge.mass_action.iterable_result_factory_registry'

    oro_entity_merge.mass_action.data_handler:
        class: Oro\Bundle\EntityMergeBundle\DataGrid\Extension\MassAction\MergeMassActionHandler
        public: true
        arguments:
            - '@oro_entity_merge.doctrine_helper'

    oro_entity_merge.mass_action.merge_mass_action_listener:
       class: Oro\Bundle\EntityMergeBundle\EventListener\DataGrid\MergeMassActionListener
       arguments:
           - '@oro_entity_config.provider.merge'
       tags:
           - { name: kernel.event_listener, event: oro_datagrid.datagrid.build.before, method: onBuildBefore }
