parameters:
    # override Doctrine Registry
    doctrine.class: Oro\Bundle\EntityBundle\ORM\Registry
    # override Doctrine event manager
    doctrine.dbal.connection.event_manager.class: Oro\Bundle\EntityBundle\Event\OroEventManager
    # override Doctrine MappingDriverChain
    doctrine.orm.metadata.driver_chain.class: Oro\Bundle\EntityBundle\ORM\MappingDriverChain

    oro_entity.listener.navigation_listener.class:                                     Oro\Bundle\EntityBundle\EventListener\NavigationListener
    oro_entity.datagrid_helper.class:                                                  Oro\Bundle\EntityBundle\Grid\GridHelper
    oro_entity.event_listener.custom_entity_grid_listener.class:                       Oro\Bundle\EntityBundle\EventListener\CustomEntityGridListener
    oro_entity.event_listener.entity_relation_grid_listener.class:                     Oro\Bundle\EntityBundle\EventListener\EntityRelationGridListener
    oro_entity.event_listener.entity_modify_created_updated_properties_listener.class: Oro\Bundle\EntityBundle\EventListener\ModifyCreatedAndUpdatedPropertiesListener
    oro_entity.exclusion_provider.config.class:                                        Oro\Bundle\EntityBundle\Provider\ConfigExclusionProvider
    oro_entity.exclusion_provider.chain.class:                                         Oro\Bundle\EntityBundle\Provider\ChainExclusionProvider
    oro_entity.dictionary_value_list_provider.class:                                   Oro\Bundle\EntityBundle\Provider\ChainDictionaryValueListProvider
    oro_entity.virtual_relation_provider.config.class:                                 Oro\Bundle\EntityBundle\Provider\ConfigVirtualRelationProvider
    oro_entity.virtual_relation_provider.chain.class:                                  Oro\Bundle\EntityBundle\Provider\ChainVirtualRelationProvider
    oro_entity.virtual_field_provider.class:                                           Oro\Bundle\EntityBundle\Provider\ConfigVirtualFieldProvider
    oro_entity.virtual_field_provider.chain.class:                                     Oro\Bundle\EntityBundle\Provider\ChainVirtualFieldProvider
    oro_entity.virtual_field_provider.dictionary.class:                                Oro\Bundle\EntityBundle\Provider\DictionaryVirtualFieldProvider
    oro_entity.virtual_field_provider.enum.class:                                      Oro\Bundle\EntityBundle\Provider\EnumVirtualFieldProvider
    oro_entity.entity_provider.class:                                                  Oro\Bundle\EntityBundle\Provider\EntityProvider
    oro_entity.entity_field_provider.class:                                            Oro\Bundle\EntityBundle\Provider\EntityFieldProvider
    oro_entity.entity_field_list_provider.class:                                       Oro\Bundle\EntityBundle\Provider\EntityWithFieldsProvider
    oro_entity.twig.extension.entity.class:                                            Oro\Bundle\EntityBundle\Twig\EntityExtension
    oro_entity.routing_helper.class:                                                   Oro\Bundle\EntityBundle\Tools\EntityRoutingHelper
    oro_entity.extension.unique_entity_extension.class:                                Oro\Bundle\EntityBundle\Form\Extension\UniqueEntityExtension
    oro_entity.listener.orm.generated_value_strategy_listener.class: Oro\Bundle\EntityBundle\EventListener\ORM\GeneratedValueStrategyListener
    oro_entity.migration.extension.change_type.class: Oro\Bundle\EntityBundle\Migrations\Extension\ChangeTypeExtension
    oro_entity.entity_alias_resolver.class:                  Oro\Bundle\EntityBundle\ORM\EntityAliasResolver
    oro_entity.entity_alias_config_bag.class:                Oro\Bundle\EntityBundle\Provider\EntityAliasConfigBag
    oro_entity.entity_alias_provider.class:                  Oro\Bundle\EntityBundle\Provider\EntityAliasProvider
    oro_entity.entity_class_name_helper.class:               Oro\Bundle\EntityBundle\Tools\EntityClassNameHelper
    oro_entity.entity_name_resolver.class:                   Oro\Bundle\EntityBundle\Provider\EntityNameResolver
    oro_entity.entity_name_provider.default.class:           Oro\Bundle\EntityBundle\Provider\EntityNameProvider
    oro_entity.entity_class_name_provider.default.class:     Oro\Bundle\EntityBundle\Provider\EntityClassNameProvider
    oro_entity.dictionary_value_list_provider.default.class: Oro\Bundle\EntityBundle\Provider\DictionaryValueListProvider
    oro_entity.orm.mapping.additional_metadata_provider.class: Oro\Bundle\EntityBundle\ORM\Mapping\AdditionalMetadataProvider

    # managers
    oro_entity.manager.dictionary.api.class:                 Oro\Bundle\EntityBundle\Entity\Manager\DictionaryApiEntityManager
    oro_entity.manager.entity_field_manager.class:           Oro\Bundle\EntityBundle\Entity\Manager\Field\EntityFieldManager
    oro_entity.manager.entity_field_validator.class:         Oro\Bundle\EntityBundle\Entity\Manager\Field\EntityFieldValidator

    # managers/api
    oro_entity.manager.api.entity_data_api_manager.class:    Oro\Bundle\EntityBundle\Manager\Api\EntityDataApiManager

    # form
    oro_entity.form.entity_field.form_builder.class:         Oro\Bundle\EntityBundle\Form\EntityField\FormBuilder

    oro_entity.form.entity_field.handler.base_handler.class: Oro\Bundle\EntityBundle\Form\EntityField\Handler\EntityApiBaseHandler
    oro_entity.form.entity_field.handler.processor.handler_processor.class:  Oro\Bundle\EntityBundle\Form\EntityField\Handler\Processor\EntityApiHandlerProcessor

    # halpers
    oro_entity.helper.dictionary.class:                      Oro\Bundle\EntityBundle\Helper\DictionaryHelper

services:
    oro_entity.entity_manager_bag:
        public: false
        class: Oro\Bundle\EntityBundle\ORM\ManagerBag
        arguments:
            - '@doctrine'

    oro_entity.listener.navigation_listener:
        class: %oro_entity.listener.navigation_listener.class%
        arguments:
            - '@oro_security.security_facade'
            - '@oro_entity_config.config_manager'
            - '@translator'
        tags:
            - { name: kernel.event_listener, event: oro_menu.configure.application_menu, method: onNavigationConfigure }

    oro_entity.extension.unique_entity_extension:
        class: %oro_entity.extension.unique_entity_extension.class%
        arguments:
            - '@validator'
            - '@translator'
            - '@oro_entity_config.provider.entity'
            - '@oro_entity.doctrine_helper'
        tags:
            - { name: form.type_extension, alias: form, extended_type: 'Symfony\Component\Form\Extension\Core\Type\FormType' }

    oro_entity.owner.entity_config_listener:
        class: Oro\Bundle\EntityBundle\EventListener\EntityConfigListener
        tags:
            - { name: kernel.event_listener, event: oro.entity_config.field.create, method: createField }

    oro_entity.datagrid_helper:
        class: %oro_entity.datagrid_helper.class%
        arguments:
            - '@oro_entity.entity_provider'

    oro_entity.event_listener.custom_entity_grid_listener:
        class: %oro_entity.event_listener.custom_entity_grid_listener.class%
        arguments:
            - '@router'
        tags:
            - { name: kernel.event_listener, event: oro_datagrid.datagrid.build.before.custom-entity-grid, method: onBuildBefore }

    oro_entity.event_listener.entity_modify_created_updated_properties_listener:
        class:  %oro_entity.event_listener.entity_modify_created_updated_properties_listener.class%
        arguments:
            - '@security.token_storage'
        tags:
            - { name: doctrine.event_listener, event: onFlush, priority: 100 }

    oro_entity.event_listener.entity_relation_grid_listener:
        class: %oro_entity.event_listener.entity_relation_grid_listener.class%
        arguments:
            - '@oro_entity_config.config_manager'
            - '@oro_entity.doctrine_helper'
        calls:
            - [setRequest, ["@?request="]]
        tags:
            - { name: kernel.event_listener, event: oro_datagrid.datagrid.build.before.entity-relation-grid, method: onBuildBefore }
            - { name: kernel.event_listener, event: oro_datagrid.datagrid.build.after.entity-relation-grid, method: onBuildAfter }

    oro_entity.entity_provider.abstract:
        abstract: true
        arguments:
            - '@oro_entity_config.provider.entity'
            - '@oro_entity_config.provider.extend'
            - '@oro_entity.orm.entity_class_resolver'
            - '@translator'
        calls:
            - [setExclusionProvider,  ['@oro_entity.exclusion_provider']]

    oro_entity.entity_provider:
        class: %oro_entity.entity_provider.class%
        parent: oro_entity.entity_provider.abstract

    oro_entity.entity_field_provider.abstract:
        abstract: true
        arguments:
            - '@oro_entity_config.provider.entity'
            - '@oro_entity_config.provider.extend'
            - '@oro_entity.orm.entity_class_resolver'
            - '@oro_entity_extend.extend.field_type_helper'
            - '@doctrine'
            - '@translator'
            - %oro_entity.hidden_fields%
        calls:
            - [setEntityProvider, ['@oro_entity.entity_provider']]
            - [setVirtualFieldProvider, ['@oro_entity.virtual_field_provider']]
            - [setVirtualRelationProvider, ['@oro_entity.virtual_relation_provider.chain']]
            - [setExclusionProvider, ['@oro_entity.exclusion_provider']]

    oro_entity.exclusion_provider:
        class: %oro_entity.exclusion_provider.chain.class%

    oro_entity.exclusion_provider.config:
        class: %oro_entity.exclusion_provider.config.class%
        arguments:
            - '@oro_entity.entity_hierarchy_provider.all'
            - %oro_entity.exclusions%
        tags:
            - { name: oro_entity.exclusion_provider.default }
            - { name: oro_entity.exclusion_provider.api, priority: 50 }

    oro_entity.virtual_field_provider.chain:
        class: %oro_entity.virtual_field_provider.chain.class%

    oro_entity.virtual_field_provider:
        class: %oro_entity.virtual_field_provider.class%
        arguments:
            - '@oro_entity.entity_hierarchy_provider.all'
            - %oro_entity.virtual_fields%
        tags:
            - { name: oro_entity.virtual_field_provider, priority: 0 }

    oro_entity.virtual_field_provider.dictionary:
        class: %oro_entity.virtual_field_provider.dictionary.class%
        arguments:
            - '@oro_entity_config.provider.grouping'
            - '@oro_entity_config.provider.dictionary'
            - '@doctrine'
        tags:
            - { name: oro_entity.virtual_field_provider, priority: 100 }

    oro_entity.virtual_field_provider.enum:
        class: %oro_entity.virtual_field_provider.enum.class%
        arguments:
            - '@oro_entity_config.provider.extend'
            - '@doctrine'
        tags:
            - { name: oro_entity.virtual_field_provider, priority: 100 }

    oro_entity.virtual_relation_provider.chain:
        class: %oro_entity.virtual_relation_provider.chain.class%

    oro_entity.virtual_relation_provider.config:
        class: %oro_entity.virtual_relation_provider.config.class%
        arguments:
            - '@oro_entity.entity_hierarchy_provider.all'
            - %oro_entity.virtual_relations%
        tags:
            - { name: oro_entity.virtual_relation_provider, priority: 0 }

    oro_entity.entity_hierarchy_provider:
        class: Oro\Bundle\EntityBundle\Provider\EntityHierarchyProvider
        public: false
        arguments:
            - '@oro_entity.doctrine_helper'
            - '@oro_entity_config.provider.extend'

    oro_entity.entity_hierarchy_provider.all:
        class: Oro\Bundle\EntityBundle\Provider\AllEntityHierarchyProvider
        public: false
        arguments:
            - '@oro_entity.doctrine_helper'
            - '@oro_entity_config.provider.extend'
            - '@oro_entity.entity_manager_bag'

    oro_entity.entity_field_provider:
        class: %oro_entity.entity_field_provider.class%
        parent: oro_entity.entity_field_provider.abstract

    oro_entity.entity_field_provider.link:
        tags:
            - { name: oro_service_link,  service: oro_entity.entity_field_provider }

    oro_entity.entity_field_list_provider:
        class: %oro_entity.entity_field_list_provider.class%
        arguments:
            - '@oro_entity.entity_field_provider'
            - '@oro_entity.entity_provider'

    oro_entity.exclusion_provider.by_alias:
        class: Oro\Bundle\EntityBundle\Provider\AliasedEntityExclusionProvider
        public: false
        arguments:
            - '@oro_entity.entity_alias_resolver'
        tags:
            - { name: oro_entity.exclusion_provider.api, priority: 40 }

    oro_entity.twig.extension.entity:
        class: %oro_entity.twig.extension.entity.class%
        arguments:
            - '@oro_entity.entity_identifier_accessor'
            - '@oro_entity.routing_helper'
            - '@oro_entity.entity_name_resolver'
            - '@oro_entity.entity_alias_resolver'
        tags:
            - { name: twig.extension }

    oro_entity.routing_helper:
        class: %oro_entity.routing_helper.class%
        arguments:
            - '@oro_entity.entity_class_name_helper'
            - '@oro_entity.doctrine_helper'
            - '@router'

    oro_entity.listener.orm.generated_value_strategy_listener:
        class: %oro_entity.listener.orm.generated_value_strategy_listener.class%
        arguments:
            - %database_driver%
        tags:
            - { name: doctrine.event_listener, event: loadClassMetadata }

    oro_entity.migration.extension.change_type:
        class: %oro_entity.migration.extension.change_type.class%
        tags:
            - { name: oro_migration.extension, extension_name: change_type }

    oro_entity.entity_alias.cache.warmer:
        class: Oro\Bundle\EntityBundle\Cache\EntityAliasCacheWarmer
        arguments:
            - '@oro_entity.entity_alias_resolver'
        tags:
            - { name: kernel.cache_warmer }

    oro_entity.additional_metadata.cache.warmer:
        class: Oro\Bundle\EntityBundle\Cache\AdditionalMetadataCacheWarmer
        arguments:
            - '@oro_entity.orm.mapping.additional_metadata_provider'
        tags:
            - { name: kernel.cache_warmer }

    oro_entity.entity_alias_resolver:
        class: %oro_entity.entity_alias_resolver.class%
        arguments:
            - '@oro_entity.entity_alias_loader'
            - '@oro_entity.entity_alias_cache'
            - %kernel.debug%
        calls:
            - [ setLogger, [ '@logger' ] ]
        lazy: true

    oro_entity.entity_alias_cache:
        parent: oro.cache.abstract
        public: false
        calls:
            - [ setNamespace, [ 'oro_entity_aliases' ] ]

    oro_entity.entity_alias_loader:
        class: Oro\Bundle\EntityBundle\Provider\EntityAliasLoader
        public: false
        lazy: true

    oro_entity.entity_class_provider.orm:
        class: Oro\Bundle\EntityBundle\ORM\OrmEntityClassProvider
        public: false
        arguments:
            - '@oro_entity.doctrine_helper'
            - '@oro_entity.entity_manager_bag'
        tags:
            - { name: oro_entity.class_provider }

    oro_entity.entity_alias_config_bag:
        class: %oro_entity.entity_alias_config_bag.class%
        public: false
        arguments:
            - %oro_entity.entity_aliases%
            - %oro_entity.entity_alias_exclusions%

    oro_entity.entity_alias_provider:
        class: %oro_entity.entity_alias_provider.class%
        public: false
        arguments:
            - '@oro_entity.entity_alias_config_bag'
        tags:
            - { name: oro_entity.alias_provider, priority: -100 }
            - { name: oro_entity.class_provider }

    oro_entity.entity_class_name_helper:
        class: %oro_entity.entity_class_name_helper.class%
        arguments:
            - '@oro_entity.entity_alias_resolver'

    oro_entity.entity_name_resolver:
        class: %oro_entity.entity_name_resolver.class%
        arguments:
            - %oro_entity.entity_name_format.default%
            - %oro_entity.entity_name_formats%

    oro_entity.entity_name_provider.default:
        class: %oro_entity.entity_name_provider.default.class%
        public: false
        arguments:
            - '@doctrine'
        tags:
            - { name: oro_entity.name_provider, priority: -100 }

    oro_entity.entity_class_name_provider:
        class: Oro\Bundle\EntityBundle\Provider\ChainEntityClassNameProvider
        public: false

    oro_entity.entity_class_name_provider.default:
        class: %oro_entity.entity_class_name_provider.default.class%
        public: false
        arguments:
            - '@oro_entity_config.config_manager'
            - '@translator'
        tags:
            - { name: oro_entity.class_name_provider, priority: -100 }

    oro_entity.dictionary_value_list_provider.default:
        class: %oro_entity.dictionary_value_list_provider.default.class%
        public: false
        arguments:
            - '@oro_entity_config.config_manager'
            - '@doctrine'
        tags:
            - { name: oro_entity.dictionary_value_list_provider, priority: -100 }

    oro_entity.orm.mapping.additional_metadata_provider:
        class: %oro_entity.orm.mapping.additional_metadata_provider.class%
        arguments:
            - '@doctrine'
            - '@doctrine.orm.default_metadata_cache'

    oro_entity.dictionary_value_list_provider:
        class: %oro_entity.dictionary_value_list_provider.class%
        public: false

    oro_entity.routing.options_resolver.dictionary_entity:
        class: Oro\Bundle\EntityBundle\Routing\DictionaryEntityRouteOptionsResolver
        public: false
        arguments:
            - '@oro_entity.dictionary_value_list_provider'
            - '@oro_entity.entity_alias_resolver'
            - '@oro_entity.entity_class_name_helper'
        calls:
            - [ setLogger, [ '@logger' ] ]
        tags:
            - { name: routing.options_resolver }

    oro_entity.api_doc_handler.dictionary:
        class: Oro\Bundle\EntityBundle\Routing\DictionaryEntityApiDocHandler
        public: false
        arguments:
            - '@oro_entity.entity_alias_resolver'
            - '@oro_entity.entity_class_name_provider'
        tags:
            - { name: nelmio_api_doc.extractor.handler }

    oro_entity.manager.dictionary.api:
        class: %oro_entity.manager.dictionary.api.class%
        parent: oro_soap.manager.entity_manager.abstract
        arguments:
            - '@doctrine.orm.entity_manager'
            - '@oro_entity.dictionary_value_list_provider'
            - '@oro_entity.helper.dictionary'
            - '@oro_entity_config.config_manager'
            - '@property_accessor'

    oro_entity.helper.dictionary:
        class: %oro_entity.helper.dictionary.class%

    oro_entity.manager.entity_field_manager:
        class: %oro_entity.manager.entity_field_manager.class%
        scope: request
        arguments:
            - '@doctrine'
            - '@oro_entity.form.entity_field.form_builder'
            - '@oro_entity.form.entity_field.handler.base_handler'
            - '@oro_entity.routing_helper'
            - '@oro_security.owner.ownership_metadata_provider'
            - '@oro_entity.manager.entity_field_validator'

    oro_entity.form.entity_field.form_builder:
            class: %oro_entity.form.entity_field.form_builder.class%
            arguments:
                - '@form.factory'
                - '@doctrine'

    oro_entity.form.entity_field.handler.base_handler:
        class: %oro_entity.form.entity_field.handler.base_handler.class%
        scope: request
        arguments:
            - '@doctrine'
            - '@oro_entity.form.entity_field.handler.processor.handler_processor'

    oro_entity.form.entity_field.handler.processor.handler_processor:
        class: %oro_entity.form.entity_field.handler.processor.handler_processor.class%

    oro_entity.manager.api.entity_data_api_manager:
        class: %oro_entity.manager.api.entity_data_api_manager.class%
        scope: request
        arguments:
            - '@oro_entity.manager.entity_field_manager'
            - '@security.authorization_checker'
            - '@oro_entity.routing_helper'

    oro_entity.manager.entity_field_validator:
        class: %oro_entity.manager.entity_field_validator.class%
        arguments:
            - '@doctrine'
            - '@translator'
