Вход Регистрация
Файл: symfony-2.7/src/Symfony/Component/Form/Extension/Validator/Type/RepeatedTypeValidatorExtension.php
Строк: 58
<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace SymfonyComponentFormExtensionValidatorType;

use 
SymfonyComponentFormAbstractTypeExtension;
use 
SymfonyComponentOptionsResolverOptions;
use 
SymfonyComponentOptionsResolverOptionsResolver;

/**
 * @author Bernhard Schussek <bschussek@gmail.com>
 */
class RepeatedTypeValidatorExtension extends AbstractTypeExtension
{
    
/**
     * {@inheritdoc}
     */
    
public function configureOptions(OptionsResolver $resolver)
    {
        
// Map errors to the first field
        
$errorMapping = function (Options $options) {
            return array(
'.' => $options['first_name']);
        };

        
$resolver->setDefaults(array(
            
'error_mapping' => $errorMapping,
        ));
    }

    
/**
     * {@inheritdoc}
     */
    
public function getExtendedType()
    {
        return 
'repeated';
    }
}
Онлайн: 1
Реклама