6
6
7
7
namespace Magento \Dhl \Setup ;
8
8
9
- use Magento \Framework \Locale \ListsInterface ;
9
+ use Magento \Framework \Locale \ResolverInterface ;
10
10
use Magento \Framework \Setup \InstallDataInterface ;
11
11
use Magento \Framework \Setup \ModuleContextInterface ;
12
12
use Magento \Framework \Setup \ModuleDataSetupInterface ;
@@ -19,31 +19,29 @@ class InstallData implements InstallDataInterface
19
19
/**
20
20
* Locale list
21
21
*
22
- * @var ListsInterface
22
+ * @var ResolverInterface
23
23
*/
24
- private $ localeLists ;
24
+ private $ localeResolver ;
25
25
26
26
/**
27
27
* Init
28
28
*
29
- * @param ListsInterface $localeLists
29
+ * @param ResolverInterface $localeResolver
30
30
*/
31
- public function __construct (ListsInterface $ localeLists )
31
+ public function __construct (ResolverInterface $ localeResolver )
32
32
{
33
- $ this ->localeLists = $ localeLists ;
33
+ $ this ->localeResolver = $ localeResolver ;
34
34
}
35
35
36
36
/**
37
37
* {@inheritdoc}
38
38
*/
39
39
public function install (ModuleDataSetupInterface $ setup , ModuleContextInterface $ context )
40
40
{
41
- $ days = $ this ->localeLists ->getTranslationList ('days ' );
42
-
43
- $ days = array_keys ($ days ['format ' ]['wide ' ]);
44
- foreach ($ days as $ key => $ value ) {
45
- $ days [$ key ] = ucfirst ($ value );
46
- }
41
+ $ days = (new \ResourceBundle (
42
+ $ this ->localeResolver ->getLocale (),
43
+ 'ICUDATA '
44
+ ))['calendar ' ]['gregorian ' ]['dayNames ' ]['format ' ]['abbreviated ' ];
47
45
48
46
$ select = $ setup ->getConnection ()->select ()->from (
49
47
$ setup ->getTable ('core_config_data ' ),
@@ -54,7 +52,12 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface
54
52
);
55
53
56
54
foreach ($ setup ->getConnection ()->fetchAll ($ select ) as $ configRow ) {
57
- $ row = ['value ' => implode (', ' , array_intersect_key ($ days , array_flip (explode (', ' , $ configRow ['value ' ]))))];
55
+ $ row = [
56
+ 'value ' => implode (
57
+ ', ' ,
58
+ array_intersect_key (iterator_to_array ($ days ), array_flip (explode (', ' , $ configRow ['value ' ])))
59
+ )
60
+ ];
58
61
$ setup ->getConnection ()->update (
59
62
$ setup ->getTable ('core_config_data ' ),
60
63
$ row ,
0 commit comments