From 52107b0c32cfe6bc18ca237e41257751007558d8 Mon Sep 17 00:00:00 2001 From: Gregwar Date: Sun, 6 Dec 2015 23:03:44 +0100 Subject: [PATCH] Using ::class instead of type alias (working w/ sf3, see #148) --- README.md | 6 ++++-- Type/CaptchaType.php | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 50b78b5..b00d674 100644 --- a/README.md +++ b/README.md @@ -99,8 +99,9 @@ You can use the "captcha" type in your forms this way: ```php add('captcha', 'captcha'); // That's all ! + $builder->add('captcha', CaptchaType::class); // That's all ! // ... ``` @@ -147,8 +148,9 @@ Example : ```php add('captcha', 'captcha', array( + $builder->add('captcha', CaptchaType::class, array( 'width' => 200, 'height' => 50, 'length' => 6, diff --git a/Type/CaptchaType.php b/Type/CaptchaType.php index 456d121..0da5afb 100644 --- a/Type/CaptchaType.php +++ b/Type/CaptchaType.php @@ -11,6 +11,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\OptionsResolver\OptionsResolverInterface; use Symfony\Component\Form\FormEvents; use Symfony\Component\Translation\TranslatorInterface; +use Symfony\Component\Form\Extension\Core\Type\TextType; use Gregwar\CaptchaBundle\Validator\CaptchaValidator; use Gregwar\CaptchaBundle\Generator\CaptchaGenerator; @@ -143,7 +144,7 @@ class CaptchaType extends AbstractType */ public function getParent() { - return 'text'; + return TextType::class; } /**