From 4bb7ad1ed7d463c6ccab7a63e83753e8a2a3c929 Mon Sep 17 00:00:00 2001 From: Tobias Feijten Date: Wed, 6 Apr 2016 21:09:41 +0200 Subject: [PATCH] Fix error in Symfony 3.0, deprecated pattern option in 2.5 --- TranslationForm/TranslationForm.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/TranslationForm/TranslationForm.php b/TranslationForm/TranslationForm.php index 50e11ea..f6c872c 100644 --- a/TranslationForm/TranslationForm.php +++ b/TranslationForm/TranslationForm.php @@ -145,18 +145,20 @@ public function guessMissingFieldOptions($guesser, $class, $property, $options) $options['field_type'] = $typeGuess->getType(); } - if (!isset($options['pattern']) && ($patternGuess = $guesser->guessPattern($class, $property))) { - $options['pattern'] = $patternGuess->getValue(); - } - if (Kernel::VERSION_ID > '20512') { if (!isset($options['attr']['maxlength']) && ($maxLengthGuess = $guesser->guessMaxLength($class, $property))) { $options['attr']['maxlength'] = $maxLengthGuess->getValue(); } + if (!isset($options['attr']['pattern']) && ($patternGuess = $guesser->guessPattern($class, $property))) { + $options['attr']['pattern'] = $patternGuess->getValue(); + } } else { if (!isset($options['max_length']) && ($maxLengthGuess = $guesser->guessMaxLength($class, $property))) { $options['max_length'] = $maxLengthGuess->getValue(); } + if (!isset($options['pattern']) && ($patternGuess = $guesser->guessPattern($class, $property))) { + $options['pattern'] = $patternGuess->getValue(); + } } return $options;