<?xml version="1.0" ?>

<container xmlns="http://symfony.com/schema/dic/services"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
    <services>
        <!--
        The following service isn't prefixed by the "doctrine.orm" namespace in order for end-users to just use
        the "doctrine_transaction" shortcut in message buses middleware config
        -->
        <service id="messenger.middleware.doctrine_transaction" class="Symfony\Bridge\Doctrine\Messenger\DoctrineTransactionMiddleware" abstract="true" public="false">
            <argument type="service" id="doctrine" />
        </service>

        <!--
        The following service isn't prefixed by the "doctrine.orm" namespace in order for end-users to just use
        the "doctrine_ping_connection" shortcut in message buses middleware config
        -->
        <service id="messenger.middleware.doctrine_ping_connection" class="Symfony\Bridge\Doctrine\Messenger\DoctrinePingConnectionMiddleware" abstract="true" public="false">
            <argument type="service" id="doctrine" />
        </service>

        <!--
        The following service isn't prefixed by the "doctrine.orm" namespace in order for end-users to just use
        the "doctrine_close_connection" shortcut in message buses middleware config
        -->
        <service id="messenger.middleware.doctrine_close_connection" class="Symfony\Bridge\Doctrine\Messenger\DoctrineCloseConnectionMiddleware" abstract="true" public="false">
            <argument type="service" id="doctrine" />
        </service>

        <!--
        The following service isn't prefixed by the "doctrine.orm" namespace in order for end-users to just use
        the "doctrine_open_transaction_logger" shortcut in message buses middleware config
        -->
        <service id="messenger.middleware.doctrine_open_transaction_logger" class="Symfony\Bridge\Doctrine\Messenger\DoctrineOpenTransactionLoggerMiddleware" abstract="true" public="false">
            <argument type="service" id="doctrine" />
            <argument>null</argument>
            <argument type="service" id="logger" />
        </service>

        <service id="doctrine.orm.messenger.event_subscriber.doctrine_clear_entity_manager" class="Symfony\Bridge\Doctrine\Messenger\DoctrineClearEntityManagerWorkerSubscriber" public="false">
            <tag name="kernel.event_subscriber" />
            <argument type="service" id="doctrine" />
        </service>

        <!--
        The services below will be removed conditionally in DoctrineExtension, if symfony/doctrine-messenger is not installed.
        -->
        <service id="messenger.transport.doctrine.factory" class="Symfony\Component\Messenger\Bridge\Doctrine\Transport\DoctrineTransportFactory" public="false">
            <argument type="service" id="doctrine" />
            <tag name="messenger.transport_factory" />
        </service>

        <service id="doctrine.orm.messenger.doctrine_schema_subscriber" class="Symfony\Bridge\Doctrine\SchemaListener\MessengerTransportDoctrineSchemaSubscriber">
            <argument type="tagged" tag="messenger.receiver" />
            <tag name="doctrine.event_subscriber" />
        </service>
        <service id="doctrine.orm.messenger.doctrine_schema_listener" class="Symfony\Bridge\Doctrine\SchemaListener\MessengerTransportDoctrineSchemaListener">
            <argument type="tagged" tag="messenger.receiver" />
            <tag name="doctrine.event_listener" event="postGenerateSchema" />
            <tag name="doctrine.event_listener" event="onSchemaCreateTable" />
        </service>
    </services>
</container>
