services:
    oro_batch.connector.registry:
        class: Oro\Bundle\BatchBundle\Connector\ConnectorRegistry
        arguments:
            - '@oro_batch.job.factory'
            - '@oro_batch.step.factory'

    oro_batch.job.factory:
        class: Oro\Bundle\BatchBundle\Job\JobFactory
        arguments:
            - '@event_dispatcher'
            - '@oro_batch.job.repository'

    oro_batch.step.factory:
        class: Oro\Bundle\BatchBundle\Step\StepFactory
        arguments:
            - '@event_dispatcher'
            - '@oro_batch.job.repository'
            - '@Doctrine\Inflector\Inflector'

    oro_batch.job.repository:
        class: Oro\Bundle\BatchBundle\Job\DoctrineJobRepository
        arguments:
            - '@doctrine'

    oro_batch.monolog.handler.batch_log_handler:
        class: Oro\Bundle\BatchBundle\Monolog\Handler\BatchLogHandler
        arguments:
            - '%kernel.logs_dir%/batch'
            - '%oro_batch.log_batch%'

    oro_batch.event_listener.logger_subscriber:
        class: Oro\Bundle\BatchBundle\EventListener\LoggerSubscriber
        arguments:
            - '@logger'
            - '@translator'
        tags:
            - { name: kernel.event_subscriber }
            - { name: monolog.logger, channel: batch }

    oro_batch.event_listener.set_job_execution_log_file_subscriber:
        class: Oro\Bundle\BatchBundle\EventListener\SetJobExecutionLogFileSubscriber
        arguments:
            - '@oro_batch.monolog.handler.batch_log_handler'
        tags:
            - { name: kernel.event_subscriber }

    oro_batch.orm.query_builder.count_query_optimizer:
        class: Oro\Bundle\BatchBundle\ORM\QueryBuilder\CountQueryBuilderOptimizer
        calls:
            - [setEventDispatcher, ['@event_dispatcher']]
            - [setRelationHelper, ['@oro_entity.helper.relation_helper']]

    oro_batch.cache.doctrine_metadata:
        parent: oro.data.cache.without_memory_cache
        tags:
            - { name: 'cache.pool', namespace: 'doctrine_metadata_batch' }
