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 28b5c1a
Show file tree
Hide file tree
Showing 19 changed files with 226 additions and 3 deletions.
11 changes: 11 additions & 0 deletions Form/Core/Type/CaptchaType.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
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;

use Genemu\Bundle\FormBundle\Gd\Type\Captcha;
Expand Down Expand Up @@ -72,8 +73,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
11 changes: 11 additions & 0 deletions Form/Core/Type/PlainType.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
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\Form\Extension\Core\Type\DateType;
Expand All @@ -20,8 +21,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
11 changes: 11 additions & 0 deletions Form/Doctrine/Type/AjaxEntityType.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

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

use Doctrine\Common\Persistence\ManagerRegistry;
Expand Down Expand Up @@ -40,8 +41,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,7 +17,9 @@
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
12 changes: 12 additions & 0 deletions Form/JQuery/Type/AutocompleterType.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,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;


use Genemu\Bundle\FormBundle\Form\Core\ChoiceList\AjaxSimpleChoiceList;
use Genemu\Bundle\FormBundle\Form\Core\DataTransformer\ChoiceToJsonTransformer;

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
14 changes: 13 additions & 1 deletion Form/JQuery/Type/DateType.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
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\Form\Extension\Core\Type\DateType as BaseDateType;

/**
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
11 changes: 11 additions & 0 deletions Form/JQuery/Type/FileType.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

use Genemu\Bundle\FormBundle\Form\Core\EventListener\FileListener;
Expand Down Expand Up @@ -74,8 +75,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
11 changes: 11 additions & 0 deletions Form/JQuery/Type/GeolocationType.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
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;

use Genemu\Bundle\FormBundle\Form\Core\EventListener\GeolocationListener;
Expand Down Expand Up @@ -64,8 +65,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(
'map' => false,
Expand Down
Loading

0 comments on commit 28b5c1a

Please sign in to comment.