Using ::class instead of type alias (working w/ sf3, see #148)

This commit is contained in:
Gregwar 2015-12-06 23:03:44 +01:00
parent e335e2a924
commit 52107b0c32
2 changed files with 6 additions and 3 deletions

View File

@ -99,8 +99,9 @@ You can use the "captcha" type in your forms this way:
```php ```php
<?php <?php
use Gregwar\CaptchaBundle\Type\CaptchaType;
// ... // ...
$builder->add('captcha', 'captcha'); // That's all ! $builder->add('captcha', CaptchaType::class); // That's all !
// ... // ...
``` ```
@ -147,8 +148,9 @@ Example :
```php ```php
<?php <?php
use Gregwar\CaptchaBundle\Type\CaptchaType;
// ... // ...
$builder->add('captcha', 'captcha', array( $builder->add('captcha', CaptchaType::class, array(
'width' => 200, 'width' => 200,
'height' => 50, 'height' => 50,
'length' => 6, 'length' => 6,

View File

@ -11,6 +11,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\OptionsResolver\OptionsResolverInterface; use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\Form\FormEvents; use Symfony\Component\Form\FormEvents;
use Symfony\Component\Translation\TranslatorInterface; use Symfony\Component\Translation\TranslatorInterface;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Gregwar\CaptchaBundle\Validator\CaptchaValidator; use Gregwar\CaptchaBundle\Validator\CaptchaValidator;
use Gregwar\CaptchaBundle\Generator\CaptchaGenerator; use Gregwar\CaptchaBundle\Generator\CaptchaGenerator;
@ -143,7 +144,7 @@ class CaptchaType extends AbstractType
*/ */
public function getParent() public function getParent()
{ {
return 'text'; return TextType::class;
} }
/** /**