9
9
use Magento \Framework \DB \Query \Generator ;
10
10
use Magento \Framework \DB \DataConverter \DataConverterInterface ;
11
11
use Magento \Framework \DB \Select \QueryModifierInterface ;
12
+ use Magento \Framework \DB \Select ;
12
13
13
14
/**
14
15
* Convert field data from one representation to another
@@ -40,16 +41,17 @@ public function __construct(
40
41
}
41
42
42
43
/**
43
- * Convert field data from one representation to another
44
+ * Get converter select
44
45
*
45
46
* @param AdapterInterface $connection
46
47
* @param string $table
47
48
* @param string $identifier
48
49
* @param string $field
49
50
* @param QueryModifierInterface|null $queryModifier
50
- * @return void
51
+ *
52
+ * @return Select
51
53
*/
52
- public function convert (
54
+ public function getSelect (
53
55
AdapterInterface $ connection ,
54
56
$ table ,
55
57
$ identifier ,
@@ -62,6 +64,28 @@ public function convert(
62
64
if ($ queryModifier ) {
63
65
$ queryModifier ->modify ($ select );
64
66
}
67
+
68
+ return $ select ;
69
+ }
70
+
71
+ /**
72
+ * Convert table field data from one representation to another uses DataConverterInterface
73
+ *
74
+ * @param AdapterInterface $connection
75
+ * @param string $table
76
+ * @param string $identifier
77
+ * @param string $field
78
+ * @param QueryModifierInterface|null $queryModifier
79
+ * @return void
80
+ */
81
+ public function convert (
82
+ AdapterInterface $ connection ,
83
+ $ table ,
84
+ $ identifier ,
85
+ $ field ,
86
+ QueryModifierInterface $ queryModifier = null
87
+ ) {
88
+ $ select = $ this ->getSelect ($ connection , $ table , $ identifier , $ field , $ queryModifier );
65
89
$ iterator = $ this ->queryGenerator ->generate ($ identifier , $ select );
66
90
foreach ($ iterator as $ selectByRange ) {
67
91
$ rows = $ connection ->fetchAll ($ selectByRange );
0 commit comments