From 52107b0c32cfe6bc18ca237e41257751007558d8 Mon Sep 17 00:00:00 2001 From: Gregwar Date: Sun, 6 Dec 2015 23:03:44 +0100 Subject: [PATCH 1/3] 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; } /** From c989422a8205c633a28c3a38c2da7f84b9dc07b9 Mon Sep 17 00:00:00 2001 From: Gregwar Date: Sun, 6 Dec 2015 23:10:05 +0100 Subject: [PATCH 2/3] Clarifying readme --- README.md | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index b00d674..d8b3f44 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,8 @@ Gregwar's CaptchaBundle ===================== -The `GregwarCaptchaBundle` adds support for a "captcha" form type for the -Symfony2 form component. - -Important note: the master of this repository is containing current development -in order to work with Symfony 2.1. If you are using Symfony 2.0 please checkout -the 2.0 branch. +The `GregwarCaptchaBundle` adds support for a captcha form type for the +Symfony form component. Installation ============ @@ -17,7 +13,15 @@ Ultimately, the GregwarCaptchaBundle files should be downloaded to the 'vendor/bundles/Gregwar/CaptchaBundle' directory. You can accomplish this several ways, depending on your personal preference. -The first method is the standard Symfony2 method. +The first method is the standard Symfony method. + +***Using Composer*** + +Use composer require to download and install the package. + +``` bash + composer require gregwar/captcha-bundle +``` ***Using the vendors script*** @@ -45,14 +49,6 @@ $ git submodule add git://github.com/Gregwar/CaptchaBundle.git vendor/bundles/Gr $ git submodule update --init ``` -***Using Composer*** - -Use composer require to download and install the package. - -``` bash - composer require gregwar/captcha-bundle -``` - ### Step 2: Configure the Autoloader If you use composer, you can skip this step. From 1862776c9a5f4958c47d3d7717f9afdd06a9cb1d Mon Sep 17 00:00:00 2001 From: Gregwar Date: Sun, 6 Dec 2015 23:20:09 +0100 Subject: [PATCH 3/3] Supporting v3 --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 6171717..660ba45 100644 --- a/composer.json +++ b/composer.json @@ -19,8 +19,8 @@ "require": { "php": ">=5.3.0", "gregwar/captcha": "~1.1", - "symfony/framework-bundle": "~2.1", - "symfony/form": "~2.1" + "symfony/framework-bundle": "~2.1 || ~3.0", + "symfony/form": "~2.1 || ~3.0" }, "autoload": { "psr-4": {