parameters:
    oro_entity_config.entity.entity_field.class:                Oro\Bundle\EntityConfigBundle\Entity\FieldConfigModel
    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.tools.command_executor.class:             Oro\Bundle\EntityConfigBundle\Tools\CommandExecutor
    oro_entity_config.config_loader.class:                      Oro\Bundle\EntityConfigBundle\Tools\ConfigLoader
    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
    oro_entity_config.helper.entity_config.class:               Oro\Bundle\EntityConfigBundle\Helper\EntityConfigHelper

services:
    oro_entity_config.link.entity_manager:
        tags:
            - { name: oro_service_link, service: doctrine.orm.config_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.entity_manager_bag:
        public: false
        class: Oro\Bundle\EntityConfigBundle\Config\EntityManagerBag
        arguments:
            - '@doctrine'

    oro_entity_config.config_manager:
        class: %oro_entity_config.config_manager.class%
        arguments:
            - '@event_dispatcher'
            - '@oro_entity_config.metadata.annotation_metadata_factory'
            - '@oro_entity_config.config_model_manager'
            - '@oro_entity_config.audit_manager'
            - '@oro_entity_config.cache'

    oro_entity_config.config_model_lock_object:
        public: false
        class: Oro\Bundle\EntityConfigBundle\Config\LockObject

    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_model_lock_object'

    oro_entity_config.helper.entity_config:
        class: %oro_entity_config.helper.entity_config.class%
        arguments:
            - '@oro_entity_config.provider.entity'
            - '@oro_security.acl.group_provider.chain'

    oro_entity_config.audit_manager:
        public: false
        class: Oro\Bundle\EntityConfigBundle\Audit\AuditManager
        arguments:
            - '@security.token_storage'
            - '@doctrine'

    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.entity_manager_bag'

    oro_entity_config.cache:
        public: false
        class: Oro\Bundle\EntityConfigBundle\Config\ConfigCache
        arguments:
            - '@oro_entity_config.config_cache_impl'
            - '@oro_entity_config.model_cache_impl'
            - %kernel.debug%

    oro_entity_config.config_cache_impl:
        public: false
        parent: oro.cache.abstract
        calls:
            - [setNamespace, [ 'oro_entity_config' ] ]

    oro_entity_config.model_cache_impl:
        public: false
        parent: oro.cache.abstract
        calls:
            - [setNamespace, [ 'oro_entity_config_model' ] ]

    oro_entity_config.config_cache_warmer:
        class: Oro\Bundle\EntityConfigBundle\Config\ConfigCacheWarmer
        arguments:
            - '@oro_entity_config.config_manager'
            - '@oro_entity_config.cache'
            - '@oro_entity_config.config_model_lock_object'
            - '@oro_entity_config.entity_manager_bag'
            - '@oro_entity.virtual_field_provider.chain'
            - '@oro_entity.virtual_relation_provider.chain'

    oro_entity_config.cache.warmer:
        public: false
        class: Oro\Bundle\EntityConfigBundle\Cache\CacheWarmer
        arguments:
            - '@oro_entity_config.config_cache_warmer'
        tags:
            - { name: kernel.cache_warmer, priority: 28 }

    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'
            - '@router'
            - '@oro_entity.entity_class_name_helper'
        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: updateConfigs, priority: -90 }
            - { name: kernel.event_listener, event: oro_migration.post_up, method: warmUpCache, priority: -255 }

    oro_entity_config.translation.helper:
        class: 'Oro\Bundle\EntityConfigBundle\Translation\ConfigTranslationHelper'
        arguments:
            - '@oro_translation.manager.translation'
            - '@translator.default'
