Skip to content

Commit 459bd9e

Browse files
authored
Merge pull request #430 from davidzzz/master
fix deprecated function in Select2Type
2 parents 6683bcc + 604f36e commit 459bd9e

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

Form/JQuery/Type/Select2Type.php

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use Symfony\Component\Form\FormBuilderInterface;
1717
use Symfony\Component\Form\FormView;
1818
use Symfony\Component\Form\FormInterface;
19-
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
19+
use Symfony\Component\OptionsResolver\OptionsResolver;
2020
use Symfony\Component\OptionsResolver\Options;
2121

2222
/**
@@ -28,7 +28,7 @@
2828
class Select2Type extends AbstractType
2929
{
3030
private $widget;
31-
31+
3232
private $configs;
3333

3434
public function __construct($widget, array $configs = array())
@@ -68,19 +68,20 @@ public function buildView(FormView $view, FormInterface $form, array $options)
6868
/**
6969
* {@inheritdoc}
7070
*/
71-
public function setDefaultOptions(OptionsResolverInterface $resolver)
71+
public function configureOptions(OptionsResolver $resolver)
7272
{
7373
$defaults = $this->configs;
7474
$resolver
7575
->setDefaults(array(
7676
'configs' => $defaults,
7777
'transformer' => null,
7878
))
79-
->setNormalizers(array(
80-
'configs' => function (Options $options, $configs) use ($defaults) {
79+
->setNormalizer(
80+
'configs',
81+
function (Options $options, $configs) use ($defaults) {
8182
return array_merge($defaults, $configs);
82-
},
83-
))
83+
}
84+
)
8485
;
8586
}
8687

@@ -89,13 +90,16 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
8990
*/
9091
public function getParent()
9192
{
92-
return $this->widget;
93+
if (class_exists('Symfony\Component\Form\Extension\Core\Type\\' . ucfirst($this->widget) . 'Type')) {
94+
return 'Symfony\Component\Form\Extension\Core\Type\\' . ucfirst($this->widget) . 'Type';
95+
}
96+
return 'Symfony\Bridge\Doctrine\Form\Type\\' . ucfirst($this->widget) . 'Type';
9397
}
9498

9599
/**
96100
* {@inheritdoc}
97101
*/
98-
public function getName()
102+
public function getBlockPrefix()
99103
{
100104
return 'genemu_jqueryselect2_' . $this->widget;
101105
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy