parameters:
    oro_entity_config.config_manager.class:                     Oro\Bundle\EntityConfigBundle\Config\ConfigManager
    oro_entity_config.config_model_manager.class:               Oro\Bundle\EntityConfigBundle\Config\ConfigModelManager
    oro_entity_config.config_audit_mamanger.class:              Oro\Bundle\EntityConfigBundle\Audit\AuditManager
    oro_entity_config.tools.command_executor.class:             Oro\Bundle\EntityConfigBundle\Tools\CommandExecutor
    oro_entity_config.config_loader.class:                      Oro\Bundle\EntityConfigBundle\Tools\ConfigLoader
    oro_entity_config.cache.cache.class:                        Oro\Bundle\EntityConfigBundle\Config\ConfigCache
    oro_entity_config.provider_bag.class:                       Oro\Bundle\EntityConfigBundle\Provider\ConfigProviderBag
    oro_entity_config.event_listener.option_set_listener.class: Oro\Bundle\EntityConfigBundle\EventListener\OptionSetListener
    oro_entity_config.event_listener.entityconfig_grid_listener.class: Oro\Bundle\EntityConfigBundle\EventListener\EntityConfigGridListener
    oro_entity_config.event_listener.entityfields_grid_listener.class: Oro\Bundle\EntityConfigBundle\EventListener\FieldConfigGridListener
    oro_entity_config.twig.extension.config.class:              Oro\Bundle\EntityConfigBundle\Twig\ConfigExtension
    oro_entity_config.migration.post_up.listener.class:         Oro\Bundle\EntityConfigBundle\EventListener\PostUpMigrationListener

services:
    oro_entity_config.link.entity_manager:
        tags:
            - { name: oro_service_link,  service: doctrine.orm.default_entity_manager }

    oro_entity_config.link.config_manager:
        tags:
            - { name: oro_service_link,  service: oro_entity_config.config_manager }

    oro_entity_config.link.security_context:
        tags:
            - { name: oro_service_link,  service: security.context }

    oro_entity_config.link.provider_bag:
        tags:
            - { name: oro_service_link,  service: oro_entity_config.provider_bag }

    oro_entity_config.config_manager:
        class: %oro_entity_config.config_manager.class%
        arguments:
            - @oro_entity_config.metadata.annotation_metadata_factory
            - @event_dispatcher
            - @oro_entity_config.link.provider_bag
            - @oro_entity_config.config_model_manager
            - @oro_entity_config.config_audit_mamanger
        calls:
            - [setCache, [@oro_entity_config.cache.cache]]

    oro_entity_config.config_model_manager:
        public: false
        class: %oro_entity_config.config_model_manager.class%
        arguments:
            - @oro_entity_config.link.entity_manager

    oro_entity_config.config_audit_mamanger:
        public: false
        class: %oro_entity_config.config_audit_mamanger.class%
        arguments:
            - @oro_entity_config.link.config_manager
            - @oro_entity_config.link.security_context

    oro_entity_config.tools.command_executor:
        class: %oro_entity_config.tools.command_executor.class%
        arguments:
            - %kernel.root_dir%/console
            - %kernel.environment%
            - @oro_cache.oro_data_cache_manager

    oro_entity_config.config_loader:
        class: %oro_entity_config.config_loader.class%
        arguments:
            - @oro_entity_config.config_manager

    oro_entity_config.provider_bag:
        class: %oro_entity_config.provider_bag.class%

    oro_entity_config.cache.cache:
        class: %oro_entity_config.cache.cache.class%
        arguments:
            - @oro_entity_config.cache.file_cache
            - @oro_entity_config.model.file_cache
            - %kernel.debug%

    oro_entity_config.cache.file_cache:
        parent: oro.cache.abstract
        calls:
            - [setNamespace, ['oro_entity_config.cache']]

    oro_entity_config.model.file_cache:
        parent: oro.cache.abstract
        calls:
            - [setNamespace, ['oro_entity_config.model']]

    oro_entity_config.event_listener.option_set_listener:
        class: %oro_entity_config.event_listener.option_set_listener.class%
        tags:
            - { name: doctrine.event_listener, event: postPersist }
            - { name: doctrine.event_listener, event: postFlush }

    oro_entity_config.event_listener.entityconfig_grid_listener:
        class: %oro_entity_config.event_listener.entityconfig_grid_listener.class%
        arguments:
            - @oro_entity_config.config_manager
            - @oro_datagrid.provider.resolver
        tags:
            - { name: kernel.event_subscriber }

    oro_entity_config.event_listener.entityfields_grid_listener:
        class: %oro_entity_config.event_listener.entityfields_grid_listener.class%
        arguments:
            - @oro_entity_config.config_manager
            - @oro_datagrid.provider.resolver
        tags:
            - { name: kernel.event_subscriber }

    oro_entity_config.event_listener.audit_log_grid_listener:
        class: %oro_dataaudit.event_listener.dataaudit_history_grid_listener.class%
        arguments:
            - [objectClass, fieldName]
        tags:
            - { name: kernel.event_listener, event: oro_datagrid.datagrid.build.after.audit-log-grid, method: onBuildAfter }
            - { name: kernel.event_listener, event: oro_datagrid.datagrid.build.after.auditfield-log-grid, method: onBuildAfter }
            - { name: kernel.event_listener, event: oro_datagrid.datagrid.build.before.auditfield-log-grid, method: onBuildBefore }

    oro_entity_config.twig.extension.config:
        class: %oro_entity_config.twig.extension.config.class%
        arguments:
            - @oro_entity_config.config_manager
        tags:
            - { name: twig.extension }

    oro_entity_config.migration.post_up.listener:
        class: %oro_entity_config.migration.post_up.listener.class%
        arguments:
            - @oro_entity_config.tools.command_executor
        tags:
            - { name: kernel.event_listener, event: oro_migration.post_up, method: onPostUp, priority: -90 }
