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

    <parameters>
        <parameter key="validator.mapping.cache.prefix" />
        <parameter key="validator.mapping.cache.file">%kernel.cache_dir%/validation.php</parameter>
    </parameters>

    <services>
        <defaults public="false" />

        <service id="validator" class="Symfony\Component\Validator\Validator\ValidatorInterface" public="true">
            <factory service="validator.builder" method="getValidator" />
        </service>
        <service id="Symfony\Component\Validator\Validator\ValidatorInterface" alias="validator" />

        <service id="validator.builder" class="Symfony\Component\Validator\ValidatorBuilderInterface" public="true">
            <factory class="Symfony\Component\Validator\Validation" method="createValidatorBuilder" />
            <call method="setConstraintValidatorFactory">
                <argument type="service" id="validator.validator_factory" />
            </call>
            <call method="setTranslator">
                <argument type="service" id="translator" />
            </call>
            <call method="setTranslationDomain">
                <argument>%validator.translation_domain%</argument>
            </call>
        </service>

        <service id="validator.mapping.class_metadata_factory" alias="validator" />

        <service id="validator.mapping.cache_warmer" class="Symfony\Bundle\FrameworkBundle\CacheWarmer\ValidatorCacheWarmer">
            <argument type="service" id="validator.builder" />
            <argument>%validator.mapping.cache.file%</argument>
            <argument type="service" id="cache.validator" />
            <tag name="kernel.cache_warmer" />
        </service>

        <service id="validator.mapping.cache.symfony" class="Symfony\Component\Validator\Mapping\Cache\Psr6Cache">
            <argument type="service">
                <service class="Symfony\Component\Cache\Adapter\PhpArrayAdapter">
                    <factory class="Symfony\Component\Cache\Adapter\PhpArrayAdapter" method="create" />
                    <argument>%validator.mapping.cache.file%</argument>
                    <argument type="service" id="cache.validator" />
                </service>
            </argument>
        </service>

        <service id="validator.mapping.cache.doctrine.apc" class="Symfony\Component\Validator\Mapping\Cache\DoctrineCache">
            <argument type="service">
                <service class="Doctrine\Common\Cache\ApcCache">
                    <call method="setNamespace">
                        <argument>%validator.mapping.cache.prefix%</argument>
                    </call>
                </service>
            </argument>
        </service>

        <service id="validator.validator_factory" class="Symfony\Component\Validator\ContainerConstraintValidatorFactory">
            <argument /> <!-- Constraint validators locator -->
        </service>

        <service id="validator.expression" class="Symfony\Component\Validator\Constraints\ExpressionValidator" public="true">
            <tag name="validator.constraint_validator" alias="validator.expression" />
        </service>

        <service id="validator.email" class="Symfony\Component\Validator\Constraints\EmailValidator" public="true">
            <argument></argument>
            <tag name="validator.constraint_validator" alias="Symfony\Component\Validator\Constraints\EmailValidator" />
        </service>
    </services>
</container>
