Skip to content

Commit f70f1d2

Browse files
committed
Explicitly define type for in condition
1 parent cde4f67 commit f70f1d2

File tree

44 files changed

+154
-81
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+154
-81
lines changed

app/code/Magento/AdvancedSearch/Model/ResourceModel/Index.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ protected function _getCatalogProductPriceData($productIds = null)
108108
['entity_id', 'customer_group_id', 'website_id', 'min_price']
109109
);
110110
if ($productIds) {
111-
$select->where('entity_id IN (?)', $productIds);
111+
$select->where('entity_id IN (?)', $productIds, \Zend_Db::BIGINT_TYPE);
112112
}
113113
$catalogProductIndexPriceSelect[] = $select;
114114
}
@@ -177,7 +177,7 @@ public function getCategoryProductIndexData($storeId = null, $productIds = null)
177177
);
178178

179179
if ($productIds) {
180-
$select->where('product_id IN (?)', $productIds);
180+
$select->where('product_id IN (?)', $productIds, \Zend_Db::BIGINT_TYPE);
181181
}
182182

183183
$result = [];

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ public function joinPrices($websiteId)
215215
public function setOptionIdsFilter($optionIds)
216216
{
217217
if (!empty($optionIds)) {
218-
$this->getSelect()->where('selection.option_id IN (?)', $optionIds);
218+
$this->getSelect()->where('selection.option_id IN (?)', $optionIds, \Zend_Db::BIGINT_TYPE);
219219
}
220220
return $this;
221221
}
@@ -229,7 +229,7 @@ public function setOptionIdsFilter($optionIds)
229229
public function setSelectionIdsFilter($selectionIds)
230230
{
231231
if (!empty($selectionIds)) {
232-
$this->getSelect()->where('selection.selection_id IN (?)', $selectionIds);
232+
$this->getSelect()->where('selection.selection_id IN (?)', $selectionIds, \Zend_Db::BIGINT_TYPE);
233233
}
234234
return $this;
235235
}

app/code/Magento/BundleGraphQl/Model/Resolver/Links/Collection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ private function fetch() : array
108108
}
109109

110110
$linkCollection->getSelect()
111-
->where($field . ' IN (?)', $this->parentIds);
111+
->where($field . ' IN (?)', $this->parentIds, \Zend_Db::BIGINT_TYPE);
112112

113113
/** @var Selection $link */
114114
foreach ($linkCollection as $link) {

app/code/Magento/Catalog/Model/Indexer/Category/Flat/AbstractAction.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,8 @@ private function getLinkIds(array $entityIds)
414414
[$linkField]
415415
)->where(
416416
'e.entity_id IN (?)',
417-
$entityIds
417+
$entityIds,
418+
\Zend_Db::BIGINT_TYPE
418419
);
419420

420421
return $this->connection->fetchCol($select);
@@ -459,10 +460,12 @@ protected function getAttributeTypeValues($type, $entityIds, $storeId)
459460
]
460461
)->where(
461462
"e.entity_id IN (?)",
462-
$entityIds
463+
$entityIds,
464+
\Zend_Db::BIGINT_TYPE
463465
)->where(
464466
'def.store_id IN (?)',
465-
[\Magento\Store\Model\Store::DEFAULT_STORE_ID, $storeId]
467+
[\Magento\Store\Model\Store::DEFAULT_STORE_ID, $storeId],
468+
\Zend_Db::BIGINT_TYPE
466469
);
467470

468471
return $this->connection->fetchAll($select);

app/code/Magento/Catalog/Model/Indexer/Category/Flat/Action/Rows.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ protected function filterIdsByStore(array $ids, $store)
119119
"path = {$rootIdExpr} OR path = {$rootCatIdExpr} OR path like {$catIdExpr}"
120120
)->where(
121121
"entity_id IN (?)",
122-
$ids
122+
$ids,
123+
\Zend_Db::BIGINT_TYPE
123124
);
124125

125126
$resultIds = [];

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -502,10 +502,11 @@ protected function createAnchorSelect(Store $store)
502502
[]
503503
)->joinInner(
504504
['cc2' => $temporaryTreeTable],
505-
'cc2.parent_id = cc.entity_id AND cc.entity_id NOT IN (' . implode(
506-
',',
507-
$rootCatIds
508-
) . ')',
505+
$this->connection->quoteInto(
506+
'cc2.parent_id = cc.entity_id AND cc.entity_id NOT IN ()',
507+
$rootCatIds,
508+
\Zend_Db::BIGINT_TYPE
509+
),
509510
[]
510511
)->joinInner(
511512
['ccp' => $this->getTable('catalog_category_product')],

app/code/Magento/Catalog/Model/Indexer/Product/Category/Action/Rows.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ private function getProductIdsWithParents(array $childProductIds): array
151151
->select()
152152
->from(['relation' => $this->getTable('catalog_product_relation')], [])
153153
->distinct(true)
154-
->where('child_id IN (?)', $childProductIds)
154+
->where('child_id IN (?)', $childProductIds, \Zend_Db::BIGINT_TYPE)
155155
->join(
156156
['cpe' => $this->getTable('catalog_product_entity')],
157157
'relation.parent_id = cpe.' . $fieldForParent,
@@ -215,7 +215,7 @@ protected function removeEntries()
215215
protected function getNonAnchorCategoriesSelect(\Magento\Store\Model\Store $store)
216216
{
217217
$select = parent::getNonAnchorCategoriesSelect($store);
218-
return $select->where('ccp.product_id IN (?)', $this->limitationByProducts);
218+
return $select->where('ccp.product_id IN (?)', $this->limitationByProducts, \Zend_Db::BIGINT_TYPE);
219219
}
220220

221221
/**
@@ -227,7 +227,7 @@ protected function getNonAnchorCategoriesSelect(\Magento\Store\Model\Store $stor
227227
protected function getAnchorCategoriesSelect(\Magento\Store\Model\Store $store)
228228
{
229229
$select = parent::getAnchorCategoriesSelect($store);
230-
return $select->where('ccp.product_id IN (?)', $this->limitationByProducts);
230+
return $select->where('ccp.product_id IN (?)', $this->limitationByProducts, \Zend_Db::BIGINT_TYPE);
231231
}
232232

233233
/**
@@ -239,7 +239,7 @@ protected function getAnchorCategoriesSelect(\Magento\Store\Model\Store $store)
239239
protected function getAllProducts(\Magento\Store\Model\Store $store)
240240
{
241241
$select = parent::getAllProducts($store);
242-
return $select->where('cp.entity_id IN (?)', $this->limitationByProducts);
242+
return $select->where('cp.entity_id IN (?)', $this->limitationByProducts, \Zend_Db::BIGINT_TYPE);
243243
}
244244

245245
/**
@@ -265,7 +265,7 @@ private function getCategoryIdsFromIndex(array $productIds): array
265265
$storeCategories = $this->connection->fetchCol(
266266
$this->connection->select()
267267
->from($this->getIndexTable($store->getId()), ['category_id'])
268-
->where('product_id IN (?)', $productIds)
268+
->where('product_id IN (?)', $productIds, \Zend_Db::BIGINT_TYPE)
269269
->distinct()
270270
);
271271
$categoryIds[] = $storeCategories;

app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,9 @@ protected function _updateTemporaryTableByStoreValues(
340340
[$attributeCode => 't.value']
341341
);
342342
if (!empty($changedIds)) {
343-
$select->where($this->_connection->quoteInto('et.entity_id IN (?)', $changedIds));
343+
$select->where(
344+
$this->_connection->quoteInto('et.entity_id IN (?)', $changedIds, \Zend_Db::BIGINT_TYPE)
345+
);
344346
}
345347
$sql = $select->crossUpdateFromSelect(['et' => $temporaryFlatTableName]);
346348
$this->_connection->query($sql);
@@ -363,7 +365,9 @@ protected function _updateTemporaryTableByStoreValues(
363365
[$columnName => $columnValue]
364366
)->where($columnValue . ' IS NOT NULL');
365367
if (!empty($changedIds)) {
366-
$select->where($this->_connection->quoteInto('et.entity_id IN (?)', $changedIds));
368+
$select->where(
369+
$this->_connection->quoteInto('et.entity_id IN (?)', $changedIds, \Zend_Db::BIGINT_TYPE))
370+
;
367371
}
368372
$sql = $select->crossUpdateFromSelect(['et' => $temporaryFlatTableName]);
369373
$this->_connection->query($sql);

app/code/Magento/Catalog/Model/Indexer/Product/Flat/TableBuilder.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,9 @@ protected function _fillTemporaryEntityTable($tableName, array $columns, array $
233233
$select->from(['e' => $tableName], $columns);
234234
$onDuplicate = false;
235235
if (!empty($changedIds)) {
236-
$select->where($this->_connection->quoteInto('e.entity_id IN (?)', $changedIds));
236+
$select->where(
237+
$this->_connection->quoteInto('e.entity_id IN (?)', $changedIds, \Zend_Db::BIGINT_TYPE)
238+
);
237239
$onDuplicate = true;
238240
}
239241
$sql = $select->insertFromSelect($temporaryEntityTable, $columns, $onDuplicate);
@@ -347,15 +349,19 @@ protected function _fillTemporaryTable(
347349
}
348350

349351
if (!empty($changedIds)) {
350-
$select->where($this->_connection->quoteInto('e.entity_id IN (?)', $changedIds));
352+
$select->where(
353+
$this->_connection->quoteInto('e.entity_id IN (?)', $changedIds, \Zend_Db::BIGINT_TYPE)
354+
);
351355
}
352356

353357
$sql = $select->insertFromSelect($temporaryTableName, $columns, true);
354358
$this->_connection->query($sql);
355359

356360
if (count($valueColumns) > 1) {
357361
if (!empty($changedIds)) {
358-
$selectValue->where($this->_connection->quoteInto('e.entity_id IN (?)', $changedIds));
362+
$selectValue->where(
363+
$this->_connection->quoteInto('e.entity_id IN (?)', $changedIds, \Zend_Db::BIGINT_TYPE)
364+
);
359365
}
360366
$sql = $selectValue->insertFromSelect($temporaryValueTableName, $valueColumns, true);
361367
$this->_connection->query($sql);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ private function deleteIndexData(array $entityIds)
410410
$select = $this->getConnection()->select()->from(
411411
['index_price' => $this->tableMaintainer->getMainTable($dimensions)],
412412
null
413-
)->where('index_price.entity_id IN (?)', $entityIds);
413+
)->where('index_price.entity_id IN (?)', $entityIds, \Zend_Db::BIGINT_TYPE);
414414
$query = $select->deleteFromSelect('index_price');
415415
$this->getConnection()->query($query);
416416
}
@@ -519,7 +519,7 @@ private function getProductsTypes(array $changedIds = [])
519519
['entity_id', 'type_id']
520520
);
521521
if ($changedIds) {
522-
$select->where('entity_id IN (?)', $changedIds);
522+
$select->where('entity_id IN (?)', $changedIds, \Zend_Db::BIGINT_TYPE);
523523
}
524524
$pairs = $this->getConnection()->fetchPairs($select);
525525

app/code/Magento/Catalog/Model/Product/Attribute/AttributeSetFinder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function findAttributeSetIdsByProductIds(array $productIds)
3737
->getSelect()
3838
->reset(Select::COLUMNS)
3939
->columns(ProductInterface::ATTRIBUTE_SET_ID)
40-
->where('entity_id IN (?)', $productIds)
40+
->where('entity_id IN (?)', $productIds, \Zend_Db::BIGINT_TYPE)
4141
->group(ProductInterface::ATTRIBUTE_SET_ID);
4242
$result = $collection->getConnection()->fetchCol($select);
4343
return $result;

app/code/Magento/Catalog/Model/Product/Price/PricePersistence.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function get(array $skus)
9797
->select()
9898
->from($this->attributeResource->getTable($this->table));
9999
return $this->attributeResource->getConnection()->fetchAll(
100-
$select->where($this->getEntityLinkField() . ' IN (?)', $ids)
100+
$select->where($this->getEntityLinkField() . ' IN (?)', $ids, \Zend_Db::BIGINT_TYPE)
101101
->where('attribute_id = ?', $this->getAttributeId())
102102
);
103103
}

app/code/Magento/Catalog/Model/Product/Price/TierPricePersistence.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function get(array $ids)
5656
{
5757
$select = $this->tierpriceResource->getConnection()->select()->from($this->tierpriceResource->getMainTable());
5858
return $this->tierpriceResource->getConnection()->fetchAll(
59-
$select->where($this->getEntityLinkField() . ' IN (?)', $ids)
59+
$select->where($this->getEntityLinkField() . ' IN (?)', $ids, \Zend_Db::BIGINT_TYPE)
6060
);
6161
}
6262

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ protected function _getLoadAttributesSelect($object, $table)
147147
->select()
148148
->from(['attr_table' => $table], [])
149149
->where("attr_table.{$this->getLinkField()} = ?", $object->getData($this->getLinkField()))
150-
->where('attr_table.store_id IN (?)', $storeIds);
150+
->where('attr_table.store_id IN (?)', $storeIds, \Zend_Db::BIGINT_TYPE);
151151

152152
if ($setId) {
153153
$select->join(
@@ -562,7 +562,11 @@ public function getAttributeRawValue($entityId, $attribute, $store)
562562
if ($typedAttributes) {
563563
foreach ($typedAttributes as $table => $_attributes) {
564564
$defaultJoinCondition = [
565-
$connection->quoteInto('default_value.attribute_id IN (?)', array_keys($_attributes)),
565+
$connection->quoteInto(
566+
'default_value.attribute_id IN (?)',
567+
array_keys($_attributes),
568+
\Zend_Db::BIGINT_TYPE
569+
),
566570
"default_value.{$this->getLinkField()} = e.{$this->getLinkField()}",
567571
'default_value.store_id = 0',
568572
];
@@ -589,7 +593,11 @@ public function getAttributeRawValue($entityId, $attribute, $store)
589593
'store_value.attribute_id'
590594
);
591595
$joinCondition = [
592-
$connection->quoteInto('store_value.attribute_id IN (?)', array_keys($_attributes)),
596+
$connection->quoteInto(
597+
'store_value.attribute_id IN (?)',
598+
array_keys($_attributes),
599+
\Zend_Db::BIGINT_TYPE
600+
),
593601
"store_value.{$this->getLinkField()} = e.{$this->getLinkField()}",
594602
'store_value.store_id = :store_id',
595603
];

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313

1414
namespace Magento\Catalog\Model\ResourceModel;
1515

16+
use Magento\Catalog\Api\Data\ProductInterface;
1617
use Magento\Catalog\Model\Indexer\Category\Product\Processor;
18+
use Magento\Catalog\Setup\CategorySetup;
1719
use Magento\Framework\App\ObjectManager;
1820
use Magento\Framework\DataObject;
1921
use Magento\Framework\EntityManager\EntityManager;
20-
use Magento\Catalog\Setup\CategorySetup;
2122
use Magento\Framework\EntityManager\MetadataPool;
22-
use Magento\Catalog\Api\Data\ProductInterface;
2323

2424
/**
2525
* Resource model for category entity
@@ -666,7 +666,8 @@ public function findWhereAttributeIs($entityIdsFilter, $attribute, $expectedValu
666666
'ci.value = :value'
667667
)->where(
668668
'ce.entity_id IN (?)',
669-
$entityIdsFilter
669+
$entityIdsFilter,
670+
\Zend_Db::BIGINT_TYPE
670671
);
671672
$this->entitiesWhereAttributesIs[$entityIdsFilterHash][$attribute->getId()][$expectedValue] =
672673
$this->getConnection()->fetchCol($selectEntities, $bind);

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ protected function _loadNodes($parentNode = null, $recursionLevel = 0, $storeId
294294
$inactiveCategories = $this->getInactiveCategoryIds();
295295

296296
if (!empty($inactiveCategories)) {
297-
$select->where('main_table.entity_id NOT IN (?)', $inactiveCategories);
297+
$select->where('main_table.entity_id NOT IN (?)', $inactiveCategories, \Zend_Db::BIGINT_TYPE);
298298
}
299299

300300
// Allow extensions to modify select (e.g. add custom category attributes to select)
@@ -681,7 +681,8 @@ public function getAnchorsAbove(array $filterIds, $storeId = 0)
681681
1
682682
)->where(
683683
'entity_id IN (?)',
684-
$filterIds
684+
$filterIds,
685+
\Zend_Db::BIGINT_TYPE
685686
);
686687

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

app/code/Magento/Catalog/Model/ResourceModel/Collection/AbstractCollection.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,12 @@ protected function _getLoadAttributesSelect($table, $attributeIds = [])
170170
['e.entity_id']
171171
)->where(
172172
"e.entity_id IN (?)",
173-
array_keys($this->_itemsById)
173+
array_keys($this->_itemsById),
174+
\Zend_Db::BIGINT_TYPE
174175
)->where(
175176
't_d.attribute_id IN (?)',
176-
$attributeIds
177+
$attributeIds,
178+
\Zend_Db::BIGINT_TYPE
177179
)->joinLeft(
178180
['t_s' => $table],
179181
implode(' AND ', $joinCondition),
@@ -192,10 +194,12 @@ protected function _getLoadAttributesSelect($table, $attributeIds = [])
192194
['e.entity_id']
193195
)->where(
194196
"e.entity_id IN (?)",
195-
array_keys($this->_itemsById)
197+
array_keys($this->_itemsById),
198+
\Zend_Db::BIGINT_TYPE
196199
)->where(
197200
'attribute_id IN (?)',
198-
$attributeIds
201+
$attributeIds,
202+
\Zend_Db::BIGINT_TYPE
199203
)->where(
200204
'store_id = ?',
201205
$this->getDefaultStoreId()

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,8 @@ public function getWebsiteIdsByProductIds($productIds)
232232
['product_id', 'website_id']
233233
)->where(
234234
'product_id IN (?)',
235-
$productIds
235+
$productIds,
236+
\Zend_Db::BIGINT_TYPE
236237
);
237238
$productsWebsites = [];
238239
foreach ($this->getConnection()->fetchAll($select) as $productInfo) {
@@ -357,7 +358,7 @@ private function deleteSelectedEntityAttributeRows(DataObject $product, array $a
357358
$entityId = $product->getData($entityIdField);
358359
foreach ($backendTables as $backendTable => $attributes) {
359360
$connection = $this->getConnection();
360-
$where = $connection->quoteInto('attribute_id IN (?)', $attributes);
361+
$where = $connection->quoteInto('attribute_id IN (?)', $attributes, \Zend_Db::BIGINT_TYPE);
361362
$where .= $connection->quoteInto(" AND {$entityIdField} = ?", $entityId);
362363
$connection->delete($backendTable, $where);
363364
}
@@ -594,7 +595,8 @@ public function getProductsSku(array $productIds)
594595
['entity_id', 'sku']
595596
)->where(
596597
'entity_id IN (?)',
597-
$productIds
598+
$productIds,
599+
\Zend_Db::BIGINT_TYPE
598600
);
599601
return $this->getConnection()->fetchAll($select);
600602
}

0 commit comments

Comments
 (0)