1 | <?php |
||
25 | class CurrencyCodeType extends AbstractType |
||
26 | { |
||
27 | /** |
||
28 | * @var array |
||
29 | */ |
||
30 | protected $defaults; |
||
31 | |||
32 | 2 | public function __construct(RatesConfigurationRegistryInterface $registry, $baseCurrencyCode, array $defaults = []) |
|
33 | { |
||
34 | 2 | $currencyCodes = []; |
|
35 | |||
36 | /** |
||
37 | * @var Configuration $configuration |
||
38 | */ |
||
39 | 2 | foreach ($registry as $configuration) { |
|
40 | 2 | $currencyCode = $configuration->getCurrencyCode(); |
|
41 | 2 | $currencyCodes[$currencyCode] = $currencyCode; |
|
42 | } |
||
43 | |||
44 | 2 | asort($currencyCodes); |
|
45 | |||
46 | 2 | $currencyCodes = array_merge([$baseCurrencyCode => $baseCurrencyCode], $currencyCodes); |
|
47 | |||
48 | 2 | $this->defaults = array_merge(array( |
|
49 | 2 | 'choice_translation_domain' => false, |
|
50 | 2 | 'choices' => $currencyCodes |
|
51 | 2 | ), $defaults); |
|
52 | 2 | } |
|
53 | |||
54 | /** |
||
55 | * {@inheritdoc} |
||
56 | */ |
||
57 | 1 | public function configureOptions(OptionsResolver $resolver) |
|
62 | |||
63 | /** |
||
64 | * {@inheritdoc} |
||
65 | */ |
||
66 | 1 | public function getParent() |
|
70 | } |
||
71 |