services:
    oro_form.validator.constraint_factory:
        class: Oro\Bundle\FormBundle\Validator\ConstraintFactory

    oro_form.twig.form_extension:
        class: Oro\Bundle\FormBundle\Twig\FormExtension
        arguments:
            - '@oro_platform.twig.service_locator'
        public: false
        tags:
            - { name: twig.extension }

    oro_form.provider.html_tag_provider:
        class: Oro\Bundle\FormBundle\Provider\HtmlTagProvider
        arguments:
            - []

    oro_form.count_query_optimization_listener:
        class: Oro\Bundle\FormBundle\EventListener\CountQueryOptimizationListener
        tags:
            - { name: kernel.event_listener, event: oro.entity.count_query.optimize, method: onOptimize }

    oro_form.event.event_dispatcher:
        class: Oro\Bundle\FormBundle\Event\EventDispatcher
        arguments:
            - '@event_dispatcher'

    oro_form.doctrine.orm.validator_initializer:
        class: Oro\Bundle\FormBundle\Validator\DoctrineInitializer
        public: false
        decorates: doctrine.orm.validator_initializer
        arguments:
            - '@.inner'

    oro_form.update_factory:
        class: Oro\Bundle\FormBundle\Model\UpdateFactory
        arguments:
            - '@form.factory'
            - '@oro_form.registry.form_handler'
            - '@oro_form.registry.form_template_data_provider_resolver'

    oro_form.update_handler:
        class: Oro\Bundle\FormBundle\Model\UpdateHandlerFacade
        public: true
        arguments:
            - '@request_stack'
            - '@session'
            - '@oro_ui.router'
            - '@oro_entity.doctrine_helper'
            - '@oro_form.update_factory'

    Oro\Bundle\FormBundle\Model\UpdateHandlerFacade:
        alias: oro_form.update_handler

    oro_form.registry.form_template_data_provider:
        class: Oro\Bundle\FormBundle\Model\FormTemplateDataProviderRegistry
        public: false
        arguments:
            - ~ # service locator

    oro_form.provider.from_template_data.default:
        class: Oro\Bundle\FormBundle\Provider\FromTemplateDataProvider
        public: false
        tags:
            - { name: oro_form.form_template_data_provider, alias: default }

    oro_form.registry.form_handler:
        class: Oro\Bundle\FormBundle\Model\FormHandlerRegistry
        arguments:
            - ~ # service locator

    Oro\Bundle\FormBundle\Model\FormHandlerRegistry:
        alias: oro_form.registry.form_handler

    oro_form.form.handler.default:
        class: Oro\Bundle\FormBundle\Form\Handler\FormHandler
        arguments:
            - '@oro_form.event.event_dispatcher'
            - '@oro_entity.doctrine_helper'
        tags:
            - { name: oro_form.form.handler, alias: default }

    oro_form.registry.form_template_data_provider_resolver:
        class: Oro\Bundle\FormBundle\Model\FormTemplateDataProviderResolver
        arguments:
            - '@oro_form.registry.form_template_data_provider'

    oro_form.provider.form_template_data.composite:
        class: Oro\Bundle\FormBundle\Provider\FormTemplateDataProviderComposite
        arguments:
            - '@oro_form.registry.form_template_data_provider_resolver'

    Oro\Bundle\FormBundle\Provider\FormTemplateDataProviderComposite:
        alias: oro_form.provider.form_template_data.composite

    oro_form.provider.form_template_data.return_action:
        class: Oro\Bundle\FormBundle\Provider\SaveAndReturnActionFormTemplateDataProvider
        tags:
            - { name: oro_form.form_template_data_provider, alias: return_action }

    Oro\Bundle\FormBundle\Provider\SaveAndReturnActionFormTemplateDataProvider:
        alias: oro_form.provider.form_template_data.return_action

    oro_form.provider.form_fields_map:
        class: Oro\Bundle\FormBundle\Provider\FormFieldsMapProvider
        arguments:
            - '@doctrine'

    oro_form.form.event_listener.disable_fields:
        class: Oro\Bundle\FormBundle\Form\EventListener\DisableFieldsEventSubscriber
        arguments:
            - !service
                class: Oro\Component\ExpressionLanguage\ExpressionLanguage
            - '@property_accessor'
