|
12 | 12 | namespace Symfony\Component\Form\Extension\Core\Type;
|
13 | 13 |
|
14 | 14 | use Symfony\Component\Form\AbstractType;
|
15 |
| -use Symfony\Component\Form\ChoiceList\ArrayChoiceList; |
16 |
| -use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface; |
17 | 15 | use Symfony\Component\Form\ChoiceList\Loader\IntlCallbackChoiceLoader;
|
18 | 16 | use Symfony\Component\Intl\Currencies;
|
19 | 17 | use Symfony\Component\OptionsResolver\Options;
|
20 | 18 | use Symfony\Component\OptionsResolver\OptionsResolver;
|
21 | 19 |
|
22 |
| -class CurrencyType extends AbstractType implements ChoiceLoaderInterface |
| 20 | +class CurrencyType extends AbstractType |
23 | 21 | {
|
24 |
| - /** |
25 |
| - * Currency loaded choice list. |
26 |
| - * |
27 |
| - * The choices are lazy loaded and generated from the Intl component. |
28 |
| - * |
29 |
| - * {@link \Symfony\Component\Intl\Intl::getCurrencyBundle()}. |
30 |
| - * |
31 |
| - * @var ArrayChoiceList |
32 |
| - * |
33 |
| - * @deprecated since Symfony 4.1 |
34 |
| - */ |
35 |
| - private $choiceList; |
36 |
| - |
37 | 22 | /**
|
38 | 23 | * {@inheritdoc}
|
39 | 24 | */
|
@@ -69,61 +54,4 @@ public function getBlockPrefix()
|
69 | 54 | {
|
70 | 55 | return 'currency';
|
71 | 56 | }
|
72 |
| - |
73 |
| - /** |
74 |
| - * {@inheritdoc} |
75 |
| - * |
76 |
| - * @deprecated since Symfony 4.1 |
77 |
| - */ |
78 |
| - public function loadChoiceList($value = null) |
79 |
| - { |
80 |
| - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED); |
81 |
| - |
82 |
| - if (null !== $this->choiceList) { |
83 |
| - return $this->choiceList; |
84 |
| - } |
85 |
| - |
86 |
| - return $this->choiceList = new ArrayChoiceList(array_flip(Currencies::getNames()), $value); |
87 |
| - } |
88 |
| - |
89 |
| - /** |
90 |
| - * {@inheritdoc} |
91 |
| - * |
92 |
| - * @deprecated since Symfony 4.1 |
93 |
| - */ |
94 |
| - public function loadChoicesForValues(array $values, $value = null) |
95 |
| - { |
96 |
| - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED); |
97 |
| - |
98 |
| - // Optimize |
99 |
| - $values = array_filter($values); |
100 |
| - if (empty($values)) { |
101 |
| - return []; |
102 |
| - } |
103 |
| - |
104 |
| - return $this->loadChoiceList($value)->getChoicesForValues($values); |
105 |
| - } |
106 |
| - |
107 |
| - /** |
108 |
| - * {@inheritdoc} |
109 |
| - * |
110 |
| - * @deprecated since Symfony 4.1 |
111 |
| - */ |
112 |
| - public function loadValuesForChoices(array $choices, $value = null) |
113 |
| - { |
114 |
| - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED); |
115 |
| - |
116 |
| - // Optimize |
117 |
| - $choices = array_filter($choices); |
118 |
| - if (empty($choices)) { |
119 |
| - return []; |
120 |
| - } |
121 |
| - |
122 |
| - // If no callable is set, choices are the same as values |
123 |
| - if (null === $value) { |
124 |
| - return $choices; |
125 |
| - } |
126 |
| - |
127 |
| - return $this->loadChoiceList($value)->getValuesForChoices($choices); |
128 |
| - } |
129 | 57 | }
|
0 commit comments