diff --git a/TranslationForm/TranslationForm.php b/TranslationForm/TranslationForm.php index 7963dae..50e11ea 100644 --- a/TranslationForm/TranslationForm.php +++ b/TranslationForm/TranslationForm.php @@ -3,6 +3,7 @@ namespace A2lix\TranslationFormBundle\TranslationForm; use Symfony\Component\Form\FormRegistry, + Symfony\Component\HttpKernel\Kernel, Doctrine\Common\Persistence\ManagerRegistry, Doctrine\Common\Util\ClassUtils; @@ -148,8 +149,14 @@ public function guessMissingFieldOptions($guesser, $class, $property, $options) $options['pattern'] = $patternGuess->getValue(); } - if (!isset($options['max_length']) && ($maxLengthGuess = $guesser->guessMaxLength($class, $property))) { - $options['max_length'] = $maxLengthGuess->getValue(); + if (Kernel::VERSION_ID > '20512') { + if (!isset($options['attr']['maxlength']) && ($maxLengthGuess = $guesser->guessMaxLength($class, $property))) { + $options['attr']['maxlength'] = $maxLengthGuess->getValue(); + } + } else { + if (!isset($options['max_length']) && ($maxLengthGuess = $guesser->guessMaxLength($class, $property))) { + $options['max_length'] = $maxLengthGuess->getValue(); + } } return $options;