@@ -65,11 +65,11 @@ class FacebookCatalogUpdate extends AbstractDb
65
65
* @param string $connectionName
66
66
*/
67
67
public function __construct (
68
- Context $ context ,
68
+ Context $ context ,
69
69
CollectionFactory $ collectionFactory ,
70
- Random $ random ,
71
- OptionProvider $ optionProvider ,
72
- DateTime $ dateTime ,
70
+ Random $ random ,
71
+ OptionProvider $ optionProvider ,
72
+ DateTime $ dateTime ,
73
73
$ connectionName = null
74
74
) {
75
75
parent ::__construct ($ context , $ connectionName );
@@ -106,7 +106,10 @@ public function addProductIds(array $ids, string $method): int
106
106
}
107
107
}
108
108
if (!empty ($ dataToInsert )) {
109
- return $ this ->getConnection ()->insertMultiple (self ::TABLE_NAME , $ dataToInsert );
109
+ $ connection = $ this ->getConnection ();
110
+
111
+ $ facebookCatalogUpdateTable = $ connection ->getTableName (self ::TABLE_NAME );
112
+ return $ connection ->insertMultiple ($ facebookCatalogUpdateTable , $ dataToInsert );
110
113
}
111
114
return 0 ;
112
115
}
@@ -146,7 +149,9 @@ public function reserveProductsForBatchId(string $method, string $batchId): int
146
149
147
150
$ connection = $ this ->getConnection ();
148
151
$ updateWhere = $ connection ->quoteInto ('row_id IN (?) ' , $ data );
149
- return $ connection ->update (self ::TABLE_NAME , ['batch_id ' => $ batchId ], $ updateWhere );
152
+
153
+ $ facebookCatalogUpdateTable = $ connection ->getTableName (self ::TABLE_NAME );
154
+ return $ connection ->update ($ facebookCatalogUpdateTable , ['batch_id ' => $ batchId ], $ updateWhere );
150
155
}
151
156
152
157
/**
@@ -158,7 +163,9 @@ public function reserveProductsForBatchId(string $method, string $batchId): int
158
163
public function deleteBatch (string $ batchId ): int
159
164
{
160
165
$ connection = $ this ->getConnection ();
161
- return $ connection ->delete (self ::TABLE_NAME , ['batch_id = ? ' => $ batchId ]);
166
+
167
+ $ facebookCatalogUpdateTable = $ connection ->getTableName (self ::TABLE_NAME );
168
+ return $ connection ->delete ($ facebookCatalogUpdateTable , ['batch_id = ? ' => $ batchId ]);
162
169
}
163
170
164
171
/**
@@ -170,7 +177,9 @@ public function deleteBatch(string $batchId): int
170
177
public function clearBatchId (string $ batchId ): int
171
178
{
172
179
$ connection = $ this ->getConnection ();
173
- return $ connection ->update (self ::TABLE_NAME , ['batch_id ' => null ], ['batch_id = ? ' => $ batchId ]);
180
+
181
+ $ facebookCatalogUpdateTable = $ connection ->getTableName (self ::TABLE_NAME );
182
+ return $ connection ->update ($ facebookCatalogUpdateTable , ['batch_id ' => null ], ['batch_id = ? ' => $ batchId ]);
174
183
}
175
184
176
185
/**
@@ -206,11 +215,16 @@ public function getReservedProducts(string $batchId): Collection
206
215
private function getChildProductLinks (array $ parentIds )
207
216
{
208
217
$ parentLinkField = $ this ->optionProvider ->getProductEntityLinkField ();
209
- $ select = $ this ->getConnection ()->select ()
210
- ->from ($ this ->getTable ('catalog_product_super_link ' ), ['parent_id ' , 'product_id ' ])
211
- ->joinLeft (['e ' => $ this ->getTable ('catalog_product_entity ' )], "e. {$ parentLinkField } = parent_id " )
218
+ $ connection = $ this ->getConnection ();
219
+
220
+ $ catalogProductSuperLinkTable = $ connection ->getTableName ('catalog_product_super_link ' );
221
+ $ catalogProductEntityTable = $ connection ->getTableName ('catalog_product_entity ' );
222
+
223
+ $ select = $ connection ->select ()
224
+ ->from ($ catalogProductSuperLinkTable , ['parent_id ' , 'product_id ' ])
225
+ ->joinLeft (['e ' => $ catalogProductEntityTable ], "e. {$ parentLinkField } = parent_id " )
212
226
->where ('e.entity_id IN (?) ' , $ parentIds );
213
- return $ this -> getConnection () ->fetchAll ($ select );
227
+ return $ connection ->fetchAll ($ select );
214
228
}
215
229
216
230
/**
@@ -225,7 +239,9 @@ public function deleteUpdateProductEntries($sku): void
225
239
return ;
226
240
}
227
241
$ connection = $ this ->getConnection ();
228
- $ connection ->delete (self ::TABLE_NAME , ['sku = ? ' => $ sku , 'method = ? ' => 'update ' ]);
242
+
243
+ $ facebookCatalogUpdateTable = $ connection ->getTableName (self ::TABLE_NAME );
244
+ $ connection ->delete ($ facebookCatalogUpdateTable , ['sku = ? ' => $ sku , 'method = ? ' => 'update ' ]);
229
245
}
230
246
231
247
/**
@@ -259,8 +275,10 @@ public function cleanupTable()
259
275
{
260
276
$ dateLimit = $ this ->dateTime ->date (null , '-7 days ' );
261
277
$ connection = $ this ->getConnection ();
278
+
279
+ $ facebookCatalogUpdateTable = $ connection ->getTableName (self ::TABLE_NAME );
262
280
return $ connection ->delete (
263
- self :: TABLE_NAME ,
281
+ $ facebookCatalogUpdateTable ,
264
282
[
265
283
"batch_id IS NOT NULL " ,
266
284
"created_at < ' {$ dateLimit }' "
0 commit comments