diff options
Diffstat (limited to 'vendor/symfony/form/Symfony/Component/Form/Extension/Validator/Type/RepeatedTypeValidatorExtension.php')
-rw-r--r-- | vendor/symfony/form/Symfony/Component/Form/Extension/Validator/Type/RepeatedTypeValidatorExtension.php | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/Type/RepeatedTypeValidatorExtension.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/Type/RepeatedTypeValidatorExtension.php new file mode 100644 index 00000000..858ff0fa --- /dev/null +++ b/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/Type/RepeatedTypeValidatorExtension.php | |||
@@ -0,0 +1,45 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Form\Extension\Validator\Type; | ||
13 | |||
14 | use Symfony\Component\Form\AbstractTypeExtension; | ||
15 | use Symfony\Component\OptionsResolver\Options; | ||
16 | use Symfony\Component\OptionsResolver\OptionsResolverInterface; | ||
17 | |||
18 | /** | ||
19 | * @author Bernhard Schussek <bschussek@gmail.com> | ||
20 | */ | ||
21 | class RepeatedTypeValidatorExtension extends AbstractTypeExtension | ||
22 | { | ||
23 | /** | ||
24 | * {@inheritdoc} | ||
25 | */ | ||
26 | public function setDefaultOptions(OptionsResolverInterface $resolver) | ||
27 | { | ||
28 | // Map errors to the first field | ||
29 | $errorMapping = function (Options $options) { | ||
30 | return array('.' => $options['first_name']); | ||
31 | }; | ||
32 | |||
33 | $resolver->setDefaults(array( | ||
34 | 'error_mapping' => $errorMapping, | ||
35 | )); | ||
36 | } | ||
37 | |||
38 | /** | ||
39 | * {@inheritdoc} | ||
40 | */ | ||
41 | public function getExtendedType() | ||
42 | { | ||
43 | return 'repeated'; | ||
44 | } | ||
45 | } | ||