@@ -178,7 +178,7 @@ private function clearByDateRange($from = null, $to = null): void
178
178
* @param string $table
179
179
* @param ?string $from
180
180
* @param ?string $to
181
- * @param null|\Magento\Framework\DB\ Select|string $subSelect
181
+ * @param null|Select|string $subSelect
182
182
* @return void
183
183
*/
184
184
private function clearTableRanges ($ table , $ from = null , $ to = null , $ subSelect = null ): void
@@ -190,8 +190,8 @@ private function clearTableRanges($table, $from = null, $to = null, $subSelect =
190
190
191
191
if ($ subSelect !== null ) {
192
192
$ dataRange = $ this ->getRange ($ subSelect );
193
- $ deleteCondition = $ this ->getConnection ()->prepareSqlCondition ('period ' , ['in ' => $ dataRange ]);
194
- $ this ->getConnection ()->delete ($ table , $ deleteCondition );
193
+ $ deleteCondition = $ this ->getConnection ()->prepareSqlCondition ('period ' , ['in ' => $ dataRange ]);
194
+ $ this ->getConnection ()->delete ($ table , $ deleteCondition );
195
195
return ;
196
196
} else {
197
197
$ condition = [];
@@ -210,22 +210,17 @@ private function clearTableRanges($table, $from = null, $to = null, $subSelect =
210
210
/**
211
211
* Get dates range to clear the table
212
212
*
213
- * @param \Magento\Framework\DB\ Select $select
214
- * @return array|false
213
+ * @param Select $select
214
+ * @return array
215
215
*/
216
- private function getRange (\ Magento \ Framework \ DB \ Select $ select )
216
+ private function getRange (Select $ select ): array
217
217
{
218
218
$ connection = $ this ->getConnection ();
219
+ $ range = [];
219
220
try {
220
- $ range = [];
221
-
222
221
$ query = $ connection ->query ($ select );
223
-
224
- while (true == ($ date = $ query ->fetchColumn ())) {
225
- $ range [] = $ date ;
226
- }
222
+ $ range = $ query ->fetchAll (\Zend_Db::FETCH_COLUMN );
227
223
} catch (\Exception $ e ) {
228
- $ range = false ;
229
224
}
230
225
return $ range ;
231
226
}
0 commit comments