<?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 https://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">
            <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" on-invalid="ignore" />
            </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>
            <deprecated>The "%service_id%" service is deprecated since Symfony 3.4 and will be removed in 4.0. Use a Psr6 cache like "validator.mapping.cache.symfony" instead.</deprecated>
        </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">
            <tag name="validator.constraint_validator" alias="validator.expression" />
        </service>

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