parameters:
#    cl_custom_fields.example.class: Chill\CustomFieldsBundle\Example

services:

    chill.custom_field.provider:
        class: Chill\CustomFieldsBundle\Service\CustomFieldProvider
        calls:
            - [setContainer, ["@service_container"]]

    Chill\CustomFieldsBundle\Service\CustomFieldProvider: '@chill.custom_field.provider'

    chill.custom_field.custom_field_choice_type:
        class: Chill\CustomFieldsBundle\Form\CustomFieldType
        arguments:
            - "@chill.custom_field.provider"
            - "@doctrine.orm.entity_manager"
            - '@chill.main.helper.translatable_string'
        tags:
            - { name: 'form.type', alias: 'custom_field_choice' }

    chill.custom_field.custom_fields_group_type:
        class: Chill\CustomFieldsBundle\Form\CustomFieldsGroupType
        arguments:
            - "%chill_custom_fields.customizables_entities%"
            - "@translator"
        tags:
            - { name: 'form.type', alias: 'custom_fields_group' }

    chill.custom_field.custom_field_type:
        class: Chill\CustomFieldsBundle\Form\Type\CustomFieldType
        arguments:
            - "@doctrine.orm.entity_manager"
            - "@chill.custom_field.provider"
        tags:
            - { name: 'form.type', alias: 'custom_field' }

    Chill\CustomFieldsBundle\CustomFields\CustomFieldText:
        autowire: true
        autoconfigure: true
        tags:
            - { name: 'chill.custom_field', type: 'text' }
    chill.custom_field.text: '@Chill\CustomFieldsBundle\CustomFields\CustomFieldText'

    chill.custom_field.number:
        class: Chill\CustomFieldsBundle\CustomFields\CustomFieldNumber
        autowire: true
        autoconfigure: true
        tags:
            - { name: 'chill.custom_field', type: 'number' }

    chill.form_extension.post_text_integer:
        class: Chill\CustomFieldsBundle\Form\Extension\PostTextIntegerExtension
        tags:
            - { name: form.type_extension, extended_type: Symfony\Component\Form\Extension\Core\Type\IntegerType }

    chill.form_extension.post_text_number:
        class: Chill\CustomFieldsBundle\Form\Extension\PostTextNumberExtension
        tags:
            - { name: form.type_extension, extended_type: Symfony\Component\Form\Extension\Core\Type\NumberType }

    Chill\CustomFieldsBundle\CustomFields\CustomFieldChoice:
        autowire: true
        autoconfigure: true
        tags:
            - { name: 'chill.custom_field', type: 'choice' }
    chill.custom_field.choice: '@Chill\CustomFieldsBundle\CustomFields\CustomFieldChoice'

    chill.custom_field.custom_fields_group_linked_custom_fields:
        class: Chill\CustomFieldsBundle\Form\Type\LinkedCustomFieldsType
        arguments:
            - "@chill.main.helper.translatable_string"
        tags:
            - { name: form.type, alias: custom_fields_group_linked_custom_fields }

    chill.custom_field.custom_fields_title_type:
        class: Chill\CustomFieldsBundle\Form\Type\CustomFieldsTitleType
        tags:
            - { name: 'form.type', alias: 'custom_field_title' }

    chill.custom_field.title:
        class: Chill\CustomFieldsBundle\CustomFields\CustomFieldTitle
        autowire: true
        autoconfigure: true
        tags:
            - { name: 'chill.custom_field', type: 'title' }

    chill.custom_field.date:
        class: Chill\CustomFieldsBundle\CustomFields\CustomFieldDate
        autoconfigure: true
        autowire: true
        tags:
            - { name: 'chill.custom_field', type: 'date' }

    chill.custom_field.helper:
        class: Chill\CustomFieldsBundle\Service\CustomFieldsHelper
        arguments:
            - "@doctrine.orm.entity_manager"
            - "@chill.custom_field.provider"

    chill.custom_field.twig.custom_fields_rendering:
        class: Chill\CustomFieldsBundle\Templating\Twig\CustomFieldRenderingTwig
        arguments:
            - "@chill.custom_field.helper"
        tags:
            - { name: twig.extension }

    chill.custom_field.twig.custom_fields_group_rendering:
        class: Chill\CustomFieldsBundle\Templating\Twig\CustomFieldsGroupRenderingTwig
        arguments:
            - "%chill_custom_fields.show_empty_values%"
        tags:
            - { name: twig.extension }

    chill.custom_field.custom_field_long_choice:
        class: Chill\CustomFieldsBundle\CustomFields\CustomFieldLongChoice
        autowire: true
        autoconfigure: true
        arguments:
            - "@chill.custom_field.custom_field_long_choice_option_repository"
            - "@chill.main.helper.translatable_string"
        tags:
            - { name: 'chill.custom_field', type: 'long_choice' }

    chill.custom_field.custom_field_long_choice_option_repository:
        class: Chill\CustomFieldsBundle\EntityRepository\CustomFieldLongChoice\OptionRepository
        factory: ["@doctrine", getRepository]
        arguments:
            - "Chill\\CustomFieldsBundle\\Entity\\CustomFieldLongChoice\\Option"

    Chill\CustomFieldsBundle\EntityRepository\CustomFieldsDefaultGroupRepository:
        autowire: true
        autoconfigure: true
