Skip to content

Commit

Permalink
Fix deprecated forms setDefaultOptions method
Browse files Browse the repository at this point in the history
  • Loading branch information
soullivaneuh committed Apr 20, 2015
1 parent 99678a4 commit 6ecace0
Show file tree
Hide file tree
Showing 19 changed files with 245 additions and 14 deletions.
14 changes: 13 additions & 1 deletion Form/Core/Type/CaptchaType.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;


use Genemu\Bundle\FormBundle\Gd\Type\Captcha;
use Genemu\Bundle\FormBundle\Form\Core\Validator\CaptchaValidator;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

/**
* CaptchaType
Expand Down Expand Up @@ -72,8 +74,18 @@ public function buildView(FormView $view, FormInterface $form, array $options)

/**
* {@inheritdoc}
*
* @todo Remove it when bumping requirements to SF 2.7+
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$this->configureOptions($resolver);
}

/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$defaults = array_merge(
array('attr' => array('autocomplete' => 'off')),
Expand Down
14 changes: 13 additions & 1 deletion Form/Core/Type/PlainType.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;


use Symfony\Component\Form\Extension\Core\Type\DateType;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

/**
* A Form type that just renders the field as a p tag. This is useful for forms where certain field
Expand All @@ -20,8 +22,18 @@ class PlainType extends AbstractType
{
/**
* {@inheritdoc}
*
* @todo Remove it when bumping requirements to SF 2.7+
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$this->configureOptions($resolver);
}

/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(array(
'widget' => 'field',
Expand Down
12 changes: 12 additions & 0 deletions Form/Core/Type/ReCaptchaType.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\Exception\FormException;
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;


/**
* ReCaptchaType
*
Expand Down Expand Up @@ -79,8 +81,18 @@ public function buildView(FormView $view, FormInterface $form, array $options)

/**
* {@inheritdoc}
*
* @todo Remove it when bumping requirements to SF 2.7+
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$this->configureOptions($resolver);
}

/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$configs = array_merge(array(
'lang' => \Locale::getDefault(),
Expand Down
12 changes: 12 additions & 0 deletions Form/Core/Type/TinymceType.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;


/**
* TinymceType
*
Expand Down Expand Up @@ -46,8 +48,18 @@ public function buildView(FormView $view, FormInterface $form, array $options)

/**
* {@inheritdoc}
*
* @todo Remove it when bumping requirements to SF 2.7+
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$this->configureOptions($resolver);
}

/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$configs = array_merge(array(
'language' => \Locale::getDefault(),
Expand Down
14 changes: 13 additions & 1 deletion Form/Doctrine/Type/AjaxDocumentType.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
use Doctrine\Common\Persistence\ManagerRegistry;
use Genemu\Bundle\FormBundle\Form\Doctrine\ChoiceList\AjaxEntityChoiceList;
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;


/**
* AjaxDocumentType
*
Expand All @@ -36,10 +38,20 @@ public function __construct(ManagerRegistry $registry)
$this->registry = $registry;
}

/**
/**
* {@inheritdoc}
*
* @todo Remove it when bumping requirements to SF 2.7+
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$this->configureOptions($resolver);
}

/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(array(
'document_manager' => null,
Expand Down
14 changes: 13 additions & 1 deletion Form/Doctrine/Type/AjaxEntityType.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@

use Symfony\Component\Form\AbstractType;
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;


use Doctrine\Common\Persistence\ManagerRegistry;

use Genemu\Bundle\FormBundle\Form\Doctrine\ChoiceList\AjaxEntityChoiceList;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

/**
* AjaxEntityType
Expand All @@ -40,8 +42,18 @@ public function __construct(ManagerRegistry $registry)

/**
* {@inheritdoc}
*
* @todo Remove it when bumping requirements to SF 2.7+
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$this->configureOptions($resolver);
}

/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$registry = $this->registry;

Expand Down
12 changes: 12 additions & 0 deletions Form/JQuery/Type/AutocompleteType.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolver;

use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\PropertyAccess\PropertyPath;
use Symfony\Component\PropertyAccess\PropertyAccess;
Expand Down Expand Up @@ -58,8 +60,18 @@ public function buildView(FormView $view, FormInterface $form, array $options)

/**
* {@inheritdoc}
*
* @todo Remove it when bumping requirements to SF 2.7+
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$this->configureOptions($resolver);
}

/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$type = $this->type;
$registry = $this->registry;
Expand Down
14 changes: 13 additions & 1 deletion Form/JQuery/Type/AutocompleterType.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@
use Symfony\Component\Form\FormView;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;


use Genemu\Bundle\FormBundle\Form\Core\ChoiceList\AjaxSimpleChoiceList;
use Genemu\Bundle\FormBundle\Form\Core\DataTransformer\ChoiceToJsonTransformer;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

/**
* @author Olivier Chauvel <[email protected]>
Expand Down Expand Up @@ -81,8 +83,18 @@ public function buildView(FormView $view, FormInterface $form, array $options)

/**
* {@inheritdoc}
*
* @todo Remove it when bumping requirements to SF 2.7+
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$this->configureOptions($resolver);
}

/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$widget = $this->widget;

Expand Down
12 changes: 12 additions & 0 deletions Form/JQuery/Type/ChosenType.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
use Symfony\Component\Form\FormView;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;


/**
* ChosenType to JQueryLib
*
Expand Down Expand Up @@ -52,8 +54,18 @@ public function buildView(FormView $view, FormInterface $form, array $options)

/**
* {@inheritdoc}
*
* @todo Remove it when bumping requirements to SF 2.7+
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$this->configureOptions($resolver);
}

/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver
->setDefaults(array(
Expand Down
12 changes: 12 additions & 0 deletions Form/JQuery/Type/ColorType.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;


/**
* ColorType
*
Expand All @@ -35,8 +37,18 @@ public function buildView(FormView $view, FormInterface $form, array $options)

/**
* {@inheritdoc}
*
* @todo Remove it when bumping requirements to SF 2.7+
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$this->configureOptions($resolver);
}

/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver
->setDefaults(array(
Expand Down
16 changes: 14 additions & 2 deletions Form/JQuery/Type/DateType.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

use Symfony\Component\Form\Extension\Core\Type\DateType as BaseDateType;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

/**
* DateType
Expand All @@ -36,7 +38,7 @@ public function __construct(array $options)
{
$this->options = $options;
}

/**
* {@inheritdoc}
*/
Expand Down Expand Up @@ -75,8 +77,18 @@ public function buildView(FormView $view, FormInterface $form, array $options)

/**
* {@inheritdoc}
*
* @todo Remove it when bumping requirements to SF 2.7+
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$this->configureOptions($resolver);
}

/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$configs = $this->options;

Expand Down
14 changes: 13 additions & 1 deletion Form/JQuery/Type/FileType.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;


use Genemu\Bundle\FormBundle\Form\Core\EventListener\FileListener;
use Genemu\Bundle\FormBundle\Form\JQuery\DataTransformer\FileToValueTransformer;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

/**
* FileType
Expand Down Expand Up @@ -74,8 +76,18 @@ public function buildView(FormView $view, FormInterface $form, array $options)

/**
* {@inheritdoc}
*
* @todo Remove it when bumping requirements to SF 2.7+
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$this->configureOptions($resolver);
}

/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$configs = $this->options;

Expand Down
Loading

0 comments on commit 6ecace0

Please sign in to comment.