imports:
    - { resource: "services/routing.yml" }
    - { resource: "services/controller.yml" }
    - { resource: "services/installer.yml" }
    - { resource: "services/commands.yml" }
    - { resource: "services/validators.yml" }
    - { resource: "services/form.yml" }

services:
    _defaults:
        public: true

    coreshop.resource_registry: '@CoreShop\Component\Resource\Metadata\RegistryInterface'
    CoreShop\Component\Resource\Metadata\RegistryInterface: '@CoreShop\Component\Resource\Metadata\Registry'
    CoreShop\Component\Resource\Metadata\Registry: ~

    pimcore.dao.object_manager: '@CoreShop\Bundle\ResourceBundle\Pimcore\ObjectManager'
    CoreShop\Bundle\ResourceBundle\Pimcore\ObjectManager: ~

    CoreShop\Bundle\ResourceBundle\Serialization\RelationsHandler:
        arguments:
            - '@doctrine.orm.entity_manager'
        tags:
            - { name: jms_serializer.handler, type: relation, direction: serialization, format: json, method: serializeRelation}
            - { name: jms_serializer.handler, type: relation, direction: deserialization, format: json, method: deserializeRelation}
            - { name: jms_serializer.handler, type: relation<?>, direction: serialization, format: json, method: serializeRelation}
            - { name: jms_serializer.handler, type: relation<?>, direction: deserialization, format: json, method: deserializeRelation}

    CoreShop\Bundle\ResourceBundle\Serialization\PimcoreObjectHandler:
        tags:
            - { name: jms_serializer.handler, type: pimcoreObject, direction: serialization, format: json, method: serializeRelation}

    CoreShop\Bundle\ResourceBundle\Serialization\PimcoreDocumentHandler:
        tags:
            - { name: jms_serializer.handler, type: pimcoreDocument, direction: serialization, format: json, method: serializeRelation}

    CoreShop\Bundle\ResourceBundle\Serialization\PimcoreAssetHandler:
         tags:
             - { name: jms_serializer.handler, type: pimcoreAsset, direction: serialization, format: json, method: serializeRelation}

    CoreShop\Bundle\ResourceBundle\Serialization\PimcoreSiteHandler:
        tags:
            - { name: jms_serializer.handler, type: pimcoreSite, direction: serialization, format: json, method: serializeRelation}

    CoreShop\Bundle\ResourceBundle\Serialization\CarbonHandler:
        tags:
            - { name: jms_serializer.handler, type: carbon, direction: serialization, format: json, method: serializeRelation }

    jms_serializer.object_constructor:
        alias: jms_serializer.doctrine_object_constructor
        public: false

    CoreShop\Bundle\ResourceBundle\Form\Extension\HttpFoundation\HttpFoundationRequestHandler:
        decorates: form.type_extension.form.request_handler
        decoration_priority: 256
        public: false

    coreshop.admin_controller.resource_settings: '@CoreShop\Bundle\ResourceBundle\Controller\ResourceSettingsController'
    CoreShop\Bundle\ResourceBundle\Controller\ResourceSettingsController:
        arguments:
          - '@CoreShop\Bundle\ResourceBundle\Controller\ViewHandler'
        calls:
          - [setContainer, ['@service_container']]

    coreshop.resource.helper.form_error_serializer: '@CoreShop\Bundle\ResourceBundle\Form\Helper\ErrorSerializer'
    CoreShop\Bundle\ResourceBundle\Form\Helper\ErrorSerializer: ~

    coreshop.doctrine.cache.pimcore: '@CoreShop\Component\Resource\Doctrine\Cache\PimcoreCache'
    CoreShop\Component\Resource\Doctrine\Cache\PimcoreCache:
        arguments:
            - '@Pimcore\Cache\Core\CoreHandlerInterface'

    CoreShop\Bundle\ResourceBundle\Serialization\Driver\PimcoreDataObjectDriver:
        decorates: 'jms_serializer.metadata.annotation_driver'
        arguments:
            - '@CoreShop\Bundle\ResourceBundle\Serialization\Driver\PimcoreDataObjectDriver.inner'
