Skip to content

Commit e7bd3ac

Browse files
committed
add cast to int type in other places
1 parent 66a0607 commit e7bd3ac

File tree

17 files changed

+47
-31
lines changed

17 files changed

+47
-31
lines changed

app/code/Magento/AdvancedPricingImportExport/Model/Export/AdvancedPricing.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,8 @@ private function fetchTierPrices(array $productIds): array
486486
)
487487
->where(
488488
'ap.' . $productEntityLinkField . ' IN (?)',
489-
$productIds
489+
$productIds,
490+
\Zend_Db::INT_TYPE
490491
);
491492

492493
if ($priceFromFilter !== null) {

app/code/Magento/Bundle/Model/ResourceModel/Selection.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@ public function getParentIdsByChild($childId)
145145
['e.entity_id as parent_product_id']
146146
)->where(
147147
$this->getMainTable() . '.product_id IN(?)',
148-
$childId
148+
$childId,
149+
\Zend_Db::INT_TYPE
149150
);
150151

151152
return $connection->fetchCol($select);

app/code/Magento/Catalog/Model/Indexer/Product/Price/AbstractAction.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -465,10 +465,11 @@ protected function _copyRelationIndexData($parentIds, $excludeIds = null)
465465
[]
466466
)->where(
467467
'e.entity_id IN(?)',
468-
$parentIds
468+
$parentIds,
469+
\Zend_Db::INT_TYPE
469470
);
470471
if (!empty($excludeIds)) {
471-
$select->where('child_id NOT IN(?)', $excludeIds);
472+
$select->where('child_id NOT IN(?)', $excludeIds, \Zend_Db::INT_TYPE);
472473
}
473474

474475
$children = $this->getConnection()->fetchCol($select);
@@ -479,7 +480,8 @@ protected function _copyRelationIndexData($parentIds, $excludeIds = null)
479480
$this->getIndexTargetTableByDimension($dimensions)
480481
)->where(
481482
'entity_id IN(?)',
482-
$children
483+
$children,
484+
\Zend_Db::INT_TYPE
483485
);
484486
$query = $select->insertFromSelect($this->_defaultIndexerResource->getIdxTable(), [], false);
485487
$this->getConnection()->query($query);
@@ -578,13 +580,14 @@ private function getParentProductsTypes(array $productsIds)
578580
['e.entity_id as parent_id', 'type_id']
579581
)->where(
580582
'l.child_id IN(?)',
581-
$productsIds
583+
$productsIds,
584+
\Zend_Db::INT_TYPE
582585
);
583586
$pairs = $this->getConnection()->fetchPairs($select);
584587

585588
$byType = [];
586589
foreach ($pairs as $productId => $productType) {
587-
$byType[$productType][$productId] = $productId;
590+
$byType[$productType][$productId] = (int)$productId;
588591
}
589592

590593
return $byType;

app/code/Magento/Catalog/Model/ResourceModel/Attribute.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ protected function _clearUselessAttributeValues(\Magento\Framework\Model\Abstrac
101101
$attributeStoreIds = array_keys($this->_storeManager->getStores());
102102
if (!empty($attributeStoreIds)) {
103103
$delCondition = [
104-
'attribute_id = ?' => $object->getId(),
104+
'attribute_id = ?' => (int)$object->getId(),
105105
'store_id IN(?)' => $attributeStoreIds,
106106
];
107107
$this->getConnection()->delete($object->getBackendTable(), $delCondition);

app/code/Magento/Catalog/Model/ResourceModel/Category.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,8 @@ public function verifyIds(array $ids)
575575
'entity_id'
576576
)->where(
577577
'entity_id IN(?)',
578-
$ids
578+
$ids,
579+
\Zend_Db::INT_TYPE
579580
);
580581

581582
return $this->getConnection()->fetchCol($select);

app/code/Magento/Catalog/Model/ResourceModel/Url.php

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,8 @@ protected function _getCategoryAttribute($attributeCode, $categoryIds, $storeId)
204204
['value' => $attributeCode, 'entity_id' => 'entity_id']
205205
)->where(
206206
'entity_id IN(?)',
207-
$categoryIds
207+
$categoryIds,
208+
\Zend_Db::INT_TYPE
208209
);
209210
} elseif ($this->_categoryAttributes[$attributeCode]['is_global'] || $storeId == 0) {
210211
$select->from(
@@ -216,7 +217,8 @@ protected function _getCategoryAttribute($attributeCode, $categoryIds, $storeId)
216217
['value']
217218
)->where(
218219
"t1.{$identifierFiled} IN(?)",
219-
$categoryIds
220+
$categoryIds,
221+
\Zend_Db::INT_TYPE
220222
)->where(
221223
'e.attribute_id = :attribute_id'
222224
)->where(
@@ -245,7 +247,8 @@ protected function _getCategoryAttribute($attributeCode, $categoryIds, $storeId)
245247
't1.attribute_id = :attribute_id'
246248
)->where(
247249
"e.entity_id IN(?)",
248-
$categoryIds
250+
$categoryIds,
251+
\Zend_Db::INT_TYPE
249252
)->group('e.entity_id');
250253

251254
$bind['attribute_id'] = $this->_categoryAttributes[$attributeCode]['attribute_id'];
@@ -308,7 +311,8 @@ public function _getProductAttribute($attributeCode, $productIds, $storeId)
308311
0
309312
)->where(
310313
'entity_id IN(?)',
311-
$productIds
314+
$productIds,
315+
\Zend_Db::INT_TYPE
312316
);
313317
} else {
314318
$valueExpr = $connection->getCheckSql('t2.value_id > 0', 't2.value', 't1.value');
@@ -326,7 +330,8 @@ public function _getProductAttribute($attributeCode, $productIds, $storeId)
326330
't1.attribute_id = :attribute_id'
327331
)->where(
328332
't1.entity_id IN(?)',
329-
$productIds
333+
$productIds,
334+
\Zend_Db::INT_TYPE
330335
);
331336
$bind['store_id'] = $storeId;
332337
}
@@ -430,7 +435,7 @@ protected function _getCategories($categoryIds, $storeId = null, $path = null)
430435

431436
// Prepare variables for checking whether categories belong to store
432437
if ($path === null) {
433-
$select->where('main_table.entity_id IN(?)', $categoryIds);
438+
$select->where('main_table.entity_id IN(?)', $categoryIds, \Zend_Db::INT_TYPE);
434439
} else {
435440
// Ensure that path ends with '/', otherwise we can get wrong results - e.g. $path = '1/2' will get '1/20'
436441
if (substr($path, -1) != '/') {
@@ -569,7 +574,7 @@ protected function _getProducts($productIds, $storeId, $entityId, &$lastEntityId
569574
$this->_productLimit
570575
);
571576
if ($productIds !== null) {
572-
$select->where('e.entity_id IN(?)', $productIds);
577+
$select->where('e.entity_id IN(?)', $productIds, \Zend_Db::INT_TYPE);
573578
}
574579

575580
$rowSet = $connection->fetchAll($select, $bind);
@@ -591,7 +596,8 @@ protected function _getProducts($productIds, $storeId, $entityId, &$lastEntityId
591596
['product_id', 'category_id']
592597
)->where(
593598
'product_id IN(?)',
594-
array_keys($products)
599+
array_keys($products),
600+
\Zend_Db::INT_TYPE
595601
);
596602
$categories = $connection->fetchAll($select);
597603
foreach ($categories as $category) {

app/code/Magento/CatalogGraphQl/DataProvider/AttributeQuery.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ private function getAttributesFromEntityTable(
148148
): Select {
149149
$select = $connection->select()
150150
->from(['e' => $entityTableName], $entityTableAttributes)
151-
->where('e.entity_id IN (?)', $entityIds);
151+
->where('e.entity_id IN (?)', $entityIds, \Zend_Db::INT_TYPE);
152152

153153
return $select;
154154
}

app/code/Magento/CatalogInventory/Model/Indexer/Stock/AbstractAction.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ public function getRelationsByChild($childIds)
167167
)->join(
168168
['relation' => $this->_getTable('catalog_product_relation')],
169169
'relation.parent_id = cpe.' . $linkField
170-
)->where('child_id IN(?)', $childIds);
170+
)->where('child_id IN(?)', $childIds, \Zend_Db::INT_TYPE);
171171
return $connection->fetchCol($select);
172172
}
173173

@@ -262,7 +262,7 @@ private function doReindex($productIds = [])
262262
// retrieve product types by processIds
263263
$select = $connection->select()
264264
->from($this->_getTable('catalog_product_entity'), ['entity_id', 'type_id'])
265-
->where('entity_id IN(?)', $productIds);
265+
->where('entity_id IN(?)', $productIds, \Zend_Db::INT_TYPE);
266266
$pairs = $connection->fetchPairs($select);
267267

268268
$byType = [];

app/code/Magento/CatalogInventory/Model/ResourceModel/Indexer/Stock/DefaultStock.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ protected function _getStockStatusSelect($entityIds = null, $usePrimaryTable = f
261261

262262
$select->columns(['status' => $this->getStatusExpression($connection, true)]);
263263
if ($entityIds !== null) {
264-
$select->where('e.entity_id IN(?)', $entityIds);
264+
$select->where('e.entity_id IN(?)', $entityIds, \Zend_Db::INT_TYPE);
265265
}
266266

267267
return $select;

app/code/Magento/CatalogInventory/Model/ResourceModel/Stock/Status.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public function getProductsStockStatuses($productIds, $websiteId, $stockId = Sto
153153

154154
$select = $this->getConnection()->select()
155155
->from($this->getMainTable(), ['product_id', 'stock_status'])
156-
->where('product_id IN(?)', $productIds)
156+
->where('product_id IN(?)', $productIds, \Zend_Db::INT_TYPE)
157157
->where('stock_id=?', (int) $stockId)
158158
->where('website_id=?', (int) $websiteId);
159159
return $this->getConnection()->fetchPairs($select);
@@ -190,7 +190,8 @@ public function getProductsType($productIds)
190190
['entity_id', 'type_id']
191191
)->where(
192192
'entity_id IN(?)',
193-
$productIds
193+
$productIds,
194+
\Zend_Db::INT_TYPE
194195
);
195196
return $this->getConnection()->fetchPairs($select);
196197
}
@@ -360,7 +361,8 @@ public function getProductStatus($productIds, $storeId = null)
360361
$attribute->getAttributeId()
361362
)->where(
362363
"t1.{$linkField} IN(?)",
363-
$productIds
364+
$productIds,
365+
\Zend_Db::INT_TYPE
364366
);
365367

366368
$rows = $connection->fetchPairs($select);

app/code/Magento/CatalogRule/Model/ResourceModel/Rule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ public function getRulePrices(\DateTimeInterface $date, $websiteId, $customerGro
187187
->where('rule_date = ?', $date->format('Y-m-d'))
188188
->where('website_id = ?', $websiteId)
189189
->where('customer_group_id = ?', $customerGroupId)
190-
->where('product_id IN(?)', $productIds);
190+
->where('product_id IN(?)', $productIds, \Zend_Db::INT_TYPE);
191191

192192
return $connection->fetchPairs($select);
193193
}

app/code/Magento/ConfigurableProduct/Model/ResourceModel/Indexer/Stock/Configurable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ protected function _getStockStatusSelect($entityIds = null, $usePrimaryTable = f
101101
$select->columns(['status' => $stockStatusExpr]);
102102

103103
if ($entityIds !== null) {
104-
$select->where('e.entity_id IN(?)', $entityIds);
104+
$select->where('e.entity_id IN(?)', $entityIds, \Zend_Db::INT_TYPE);
105105
}
106106

107107
return $select;

app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Type/Configurable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ public function getParentIdsByChild($childId)
203203
['e' => $this->getTable('catalog_product_entity')],
204204
'e.' . $this->optionProvider->getProductEntityLinkField() . ' = l.parent_id',
205205
['e.entity_id']
206-
)->where('l.product_id IN(?)', $childId);
206+
)->where('l.product_id IN(?)', $childId, \Zend_Db::INT_TYPE);
207207
$parentIds = $this->getConnection()->fetchCol($select);
208208

209209
return $parentIds;

app/code/Magento/GroupedProduct/Model/ResourceModel/Indexer/Stock/Grouped.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ protected function _getStockStatusSelect($entityIds = null, $usePrimaryTable = f
9494
$select->columns(['status' => $stockStatusExpr]);
9595

9696
if ($entityIds !== null) {
97-
$select->where('e.entity_id IN(?)', $entityIds);
97+
$select->where('e.entity_id IN(?)', $entityIds, \Zend_Db::INT_TYPE);
9898
}
9999

100100
return $select;

app/code/Magento/GroupedProduct/Model/ResourceModel/Product/Indexer/Price/Grouped.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ private function prepareGroupedProductPriceDataSelect(array $dimensions, array $
166166
);
167167

168168
if ($entityIds !== null) {
169-
$select->where('e.entity_id IN(?)', $entityIds);
169+
$select->where('e.entity_id IN(?)', $entityIds, \Zend_Db::INT_TYPE);
170170
}
171171

172172
return $select;

app/code/Magento/ProductVideo/Model/ResourceModel/Video.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ public function loadByIds(array $ids)
3939
$this->getMainTable()
4040
)->where(
4141
'value_id IN(?)',
42-
$ids
42+
$ids,
43+
\Zend_Db::INT_TYPE
4344
);
4445

4546
return $this->getConnection()->fetchAll($select);

app/code/Magento/Reports/Model/ResourceModel/Customer/Collection.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,8 @@ protected function _addOrdersStatistics()
213213
\Magento\Sales\Model\Order::STATE_CANCELED
214214
)->where(
215215
'orders.customer_id IN(?)',
216-
$customerIds
216+
$customerIds,
217+
\Zend_Db::INT_TYPE
217218
)->group(
218219
'orders.customer_id'
219220
);

0 commit comments

Comments
 (0)