
parameters:
#    d2_core.example.class: D2\CoreBundle\Example

services:
    d2_config_manager:
        class:          D2\CoreBundle\DependencyInjection\Services\ConfigManager
        arguments:      [@doctrine]

    d2_core_tag_manager:
        class:          D2\CoreBundle\DependencyInjection\Services\TagManager
        arguments:      [@service_container, @doctrine.orm.entity_manager]

    d2_core_image_manager:
        class:          D2\CoreBundle\DependencyInjection\Services\ImageManager
        arguments:      [@service_container, @doctrine.orm.entity_manager]

    d2_core.menu_builder:
        class: "D2\CoreBundle\Menu\Builder"
        arguments: ['@security.context', '@knp_menu.factory']

    d2_core.menu.main:
        class: Knp\Menu\MenuItem # the service definition requires setting the class
        factory_service: d2_core.menu_builder
        factory_method: mainMenu
        scope: request # needed as we have the request as a dependency here
        tags:
            - { name: knp_menu.menu, alias: main } # The alias is what is used to retrieve the menu

    d2_system_notification_manager:
        class:          D2\CoreBundle\DependencyInjection\Services\SystemNotificationManager
        arguments:      [@service_container, @mailer, @templating, @doctrine.orm.entity_manager]

    d2_query_helper:
        class:          D2\CoreBundle\DependencyInjection\Services\QueryHelper

    d2_core.twig.core_extension:
        class:          D2\CoreBundle\Twig\TagTwigExtension
        arguments:      [@doctrine, @service_container]
        tags:
            - { name: twig.extension }

    d2_core_bundle.twig.config_extension:
        class:          D2\CoreBundle\Twig\ConfigTwigExtension
        arguments:      [@d2_config_manager]
        tags:
            - { name: twig.extension }

    d2_core.twig.social_extension:
        class:          D2\CoreBundle\Twig\SocialTwigExtension
        arguments:      [@doctrine, @service_container]
        tags:
            - { name: twig.extension }

    # event listeners
    kernel.listener.ajax_exception_listener:
        class: D2\CoreBundle\DependencyInjection\EventListeners\AjaxExceptionListener
        tags:
            - { name: kernel.event_listener, event: kernel.exception, method: onCoreException, priority: 1000 }

 
    kernel.listener.pdf_response_listener:
        class: D2\CoreBundle\DependencyInjection\EventListeners\PDFResponseListener
        arguments: [@knp_snappy.pdf]
        tags:
            - { name: kernel.event_listener, event: kernel.response, method: onKernelResponse }
            
 
    kernel.listener.core_request_listener:
        class: D2\CoreBundle\DependencyInjection\EventListeners\CoreRequestListener
        arguments: [@service_container]
        tags:
            - { name: kernel.event_listener, event: kernel.request, method: onKernelRequest }
            
    kernel.ie_session.after_listener:
        class: D2\CoreBundle\EventListener\IESessionListener
        tags:
            - { name: kernel.event_listener, event: kernel.response, method: onKernelResponse }
