7
7
8
8
namespace Magento \Setup \Model ;
9
9
10
+ use Magento \Framework \ObjectManagerInterface ;
10
11
use Magento \Framework \Setup \Option \AbstractConfigOption ;
11
12
use Magento \Framework \Validation \ValidationException ;
12
- use Magento \Search \Model \SearchEngine \Validator as SearchEngineValidator ;
13
- use Magento \Search \Setup \CompositeInstallConfig as InstallConfig ;
13
+ use Magento \Search \Model \SearchEngine \Validator ;
14
+ use Magento \Search \Setup \CompositeInstallConfig ;
14
15
use Magento \Setup \Exception as SetupException ;
15
16
16
17
/**
@@ -24,28 +25,20 @@ class SearchConfig
24
25
private $ searchConfigOptionsList ;
25
26
26
27
/**
27
- * @var InstallConfig
28
+ * @var ObjectManagerInterface
28
29
*/
29
- private $ installConfig ;
30
-
31
- /**
32
- * @var SearchEngineValidator
33
- */
34
- private $ searchValidator ;
30
+ private $ objectManager ;
35
31
36
32
/**
33
+ * @param ObjectManagerInterface $objectManager
37
34
* @param SearchConfigOptionsList $searchConfigOptionsList
38
- * @param InstallConfig $installConfig
39
- * @param SearchEngineValidator $searchValidator
40
35
*/
41
36
public function __construct (
42
- SearchConfigOptionsList $ searchConfigOptionsList ,
43
- InstallConfig $ installConfig ,
44
- SearchEngineValidator $ searchValidator
37
+ ObjectManagerInterface $ objectManager ,
38
+ SearchConfigOptionsList $ searchConfigOptionsList
45
39
) {
40
+ $ this ->objectManager = $ objectManager ;
46
41
$ this ->searchConfigOptionsList = $ searchConfigOptionsList ;
47
- $ this ->installConfig = $ installConfig ;
48
- $ this ->searchValidator = $ searchValidator ;
49
42
}
50
43
51
44
/**
@@ -62,7 +55,9 @@ public function saveConfiguration(array $inputOptions)
62
55
$ this ->validateSearchEngineSelection ($ searchConfigOptions );
63
56
}
64
57
try {
65
- $ this ->installConfig ->configure ($ searchConfigOptions );
58
+ /** @var CompositeInstallConfig $installConfig */
59
+ $ installConfig = $ this ->objectManager ->get (CompositeInstallConfig::class);
60
+ $ installConfig ->configure ($ searchConfigOptions );
66
61
} catch (\Exception $ e ) {
67
62
throw new SetupException ($ e ->getMessage ());
68
63
}
@@ -77,7 +72,9 @@ public function saveConfiguration(array $inputOptions)
77
72
*/
78
73
public function validateSearchEngine (array $ config = [])
79
74
{
80
- $ validationErrors = $ this ->searchValidator ->validate ($ config );
75
+ /** @var Validator $searchValidator */
76
+ $ searchValidator = $ this ->objectManager ->get (Validator::class);
77
+ $ validationErrors = $ searchValidator ->validate ($ config );
81
78
if (!empty ($ validationErrors )) {
82
79
throw new ValidationException (__ (implode (PHP_EOL , $ validationErrors )));
83
80
}
0 commit comments