<?xml version="1.0" encoding="UTF-8"?>

<!--

 This file is part of the Sylius package.

 (c) Paweł Jędrzejewski

 For the full copyright and license information, please view the LICENSE
 file that was distributed with this source code.

-->

<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
                                      http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">

    <mapped-superclass name="Sylius\Component\Sequence\Model\Sequence" table="sylius_sequence">
        <id name="id" column="id" type="integer">
            <generator strategy="AUTO" />
        </id>
        <field name="index" column="idx" type="integer" />
        <field name="type" type="string" unique="true" />
    </mapped-superclass>

</doctrine-mapping>
                                                              <?xml version="1.0" encoding="UTF-8" ?>

<!--

 This file is part of the Sylius package.

 (c) Paweł Jędrzejewski

 For the full copyright and license information, please view the LICENSE
 file that was distributed with this source code.

-->

<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">

    <parameters>
        <parameter key="sylius.sequence.doctrine_number_listener.class">Sylius\Bundle\SequenceBundle\Doctrine\ORM\NumberListener</parameter>
    </parameters>

    <services>
        <service id="sylius.sequence.doctrine_number_listener" class="%sylius.sequence.doctrine_number_listener.class%">
            <argument type="service" id="sylius.registry.number_generator" />
            <argument type="service">
                <service class="Doctrine\Common\EventManager" factory-service="doctrine.orm.entity_manager" factory-method="getEventManager" />
            </argument>
            <argument type="service" id="event_dispatcher" />
            <argument>%sylius.model.sequence.class%</argument>
        </service>
    </services>

</container>
