Skip to content

Commit fd4b631

Browse files
committed
Merge branch 'indexers' into eav_switching
2 parents 79461c0 + ccb9148 commit fd4b631

File tree

262 files changed

+2138
-3655
lines changed

Some content is hidden

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

262 files changed

+2138
-3655
lines changed

app/code/Magento/Braintree/Model/Paypal/Helper/QuoteUpdater.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,5 +182,10 @@ private function updateAddressData(Address $address, array $addressData)
182182
$address->setRegionCode($addressData['region']);
183183
$address->setCountryId($addressData['countryCodeAlpha2']);
184184
$address->setPostcode($addressData['postalCode']);
185+
186+
// PayPal's address supposes not saving against customer account
187+
$address->setSaveInAddressBook(false);
188+
$address->setSameAsBilling(false);
189+
$address->setCustomerAddressId(null);
185190
}
186191
}

app/code/Magento/Bundle/Pricing/Adjustment/Calculator.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -316,9 +316,11 @@ protected function calculateDynamicBundleAmount($basePriceValue, $bundleProduct,
316316

317317
foreach ($selectionPriceList as $selectionPrice) {
318318
++$i;
319-
$amountList[$i]['amount'] = $selectionPrice->getAmount();
320-
// always honor the quantity given
321-
$amountList[$i]['quantity'] = $selectionPrice->getQuantity();
319+
if ($selectionPrice) {
320+
$amountList[$i]['amount'] = $selectionPrice->getAmount();
321+
// always honor the quantity given
322+
$amountList[$i]['quantity'] = $selectionPrice->getQuantity();
323+
}
322324
}
323325

324326
/** @var Store $store */

app/code/Magento/Catalog/Block/Adminhtml/Product/Edit.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ public function getDuplicateUrl()
249249
}
250250

251251
/**
252+
* @deprecated
252253
* @return string
253254
*/
254255
public function getHeader()

app/code/Magento/Catalog/Controller/Adminhtml/Product/Save.php

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ public function execute()
9797
$productTypeId = $this->getRequest()->getParam('type');
9898
if ($data) {
9999
try {
100-
$this->unserializeProductData($data);
101100
$product = $this->initializationHelper->initialize(
102101
$this->productBuilder->build($this->getRequest())
103102
);
@@ -181,30 +180,6 @@ public function execute()
181180
return $resultRedirect;
182181
}
183182

184-
/**
185-
* Unserialize product data for configurable products
186-
*
187-
* @param array $postData
188-
* @return void
189-
*/
190-
private function unserializeProductData($postData)
191-
{
192-
if (isset($postData["configurable-matrix-serialized"])) {
193-
$configurableMatrixSerialized = $postData["configurable-matrix-serialized"];
194-
if ($configurableMatrixSerialized != null && !empty($configurableMatrixSerialized)) {
195-
$postData["configurable-matrix"] = json_decode($configurableMatrixSerialized, true);
196-
unset($postData["configurable-matrix-serialized"]);
197-
}
198-
}
199-
if (isset($postData["associated_product_ids_serialized"])) {
200-
$associatedProductIdsSerialized = $postData["associated_product_ids_serialized"];
201-
if ($associatedProductIdsSerialized != null && !empty($associatedProductIdsSerialized)) {
202-
$postData["associated_product_ids"] = json_decode($associatedProductIdsSerialized, true);
203-
unset($postData["associated_product_ids_serialized"]);
204-
}
205-
}
206-
}
207-
208183
/**
209184
* Notify customer when image was not deleted in specific case.
210185
* TODO: temporary workaround must be eliminated in MAGETWO-45306

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,8 +583,10 @@ public function getIsActiveAttributeId()
583583
*/
584584
public function findWhereAttributeIs($entityIdsFilter, $attribute, $expectedValue)
585585
{
586+
// @codingStandardsIgnoreStart
586587
$serializeData = $this->serializer->serialize($entityIdsFilter);
587588
$entityIdsFilterHash = md5($serializeData);
589+
// @codingStandardsIgnoreEnd
588590

589591
if (!isset($this->entitiesWhereAttributesIs[$entityIdsFilterHash][$attribute->getId()][$expectedValue])) {
590592
$linkField = $this->getLinkField();
@@ -767,7 +769,6 @@ public function getChildren($category, $recursive = true)
767769
$backendTable = $this->getTable([$this->getEntityTablePrefix(), 'int']);
768770
$connection = $this->getConnection();
769771
$checkSql = $connection->getCheckSql('c.value_id > 0', 'c.value', 'd.value');
770-
$linkField = $this->getLinkField();
771772
$bind = [
772773
'attribute_id' => $attributeId,
773774
'store_id' => $category->getStoreId(),

app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Eav/Source.php

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
*/
1616
class Source extends AbstractEav
1717
{
18-
const TRANSIT_PREFIX = 'transit_';
19-
2018
/**
2119
* Catalog resource helper
2220
*
@@ -375,45 +373,4 @@ private function saveDataFromSelect(\Magento\Framework\DB\Select $select, array
375373

376374
$this->_saveIndexData($data);
377375
}
378-
379-
/**
380-
* @inheritdoc
381-
*/
382-
protected function _prepareRelationIndex($parentIds = null)
383-
{
384-
$connection = $this->getConnection();
385-
$idxTable = $this->getIdxTable();
386-
387-
if (!$this->tableStrategy->getUseIdxTable()) {
388-
$additionalIdxTable = $connection->getTableName(self::TRANSIT_PREFIX . $this->getIdxTable());
389-
$connection->createTemporaryTableLike($additionalIdxTable, $idxTable);
390-
391-
$query = $connection->insertFromSelect(
392-
$this->_prepareRelationIndexSelect($parentIds),
393-
$additionalIdxTable,
394-
[]
395-
);
396-
$connection->query($query);
397-
398-
$select = $connection->select()->from($additionalIdxTable);
399-
$query = $connection->insertFromSelect(
400-
$select,
401-
$idxTable,
402-
[],
403-
\Magento\Framework\DB\Adapter\AdapterInterface::INSERT_IGNORE
404-
);
405-
$connection->query($query);
406-
407-
$connection->dropTemporaryTable($additionalIdxTable);
408-
} else {
409-
$query = $connection->insertFromSelect(
410-
$this->_prepareRelationIndexSelect($parentIds),
411-
$idxTable,
412-
[],
413-
\Magento\Framework\DB\Adapter\AdapterInterface::INSERT_IGNORE
414-
);
415-
$connection->query($query);
416-
}
417-
return $this;
418-
}
419376
}

app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/CompositeProductRowSizeEstimator.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
*/
1616
class CompositeProductRowSizeEstimator implements IndexTableRowSizeEstimatorInterface
1717
{
18+
/**
19+
* Calculated memory size for one record in catalog_product_index_price table
20+
*/
21+
const MEMORY_SIZE_FOR_ONE_ROW = 200;
22+
1823
/**
1924
* @var DefaultPrice
2025
*/
@@ -76,8 +81,8 @@ public function estimateRowSize()
7681
* $maxRelatedProductCount - maximum number of related products
7782
* $websitesCount - active websites
7883
* $customerGroupCount - active customer groups
79-
* 200 - calculated memory size for one record in catalog_product_index_price table
84+
* MEMORY_SIZE_FOR_ONE_ROW - calculated memory size for one record in catalog_product_index_price table
8085
*/
81-
return ceil($maxRelatedProductCount * $websitesCount * $customerGroupCount * 200);
86+
return ceil($maxRelatedProductCount * $websitesCount * $customerGroupCount * self::MEMORY_SIZE_FOR_ONE_ROW);
8287
}
8388
}

app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/IndexTableRowSizeEstimator.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
*/
1313
class IndexTableRowSizeEstimator implements \Magento\Framework\Indexer\IndexTableRowSizeEstimatorInterface
1414
{
15+
/**
16+
* Calculated memory size for one record in catalog_product_index_price table
17+
*/
18+
const MEMORY_SIZE_FOR_ONE_ROW = 120;
19+
1520
/**
1621
* @var \Magento\Store\Api\WebsiteManagementInterface
1722
*/
@@ -51,8 +56,8 @@ public function estimateRowSize()
5156
*
5257
* $websitesCount - active websites
5358
* $customerGroupCount - active customer groups
54-
* 120 - calculated memory size for one record in catalog_product_index_price table
59+
* MEMORY_SIZE_FOR_ONE_ROW - calculated memory size for one record in catalog_product_index_price table
5560
*/
56-
return ceil($websitesCount * $customerGroupCount * 120);
61+
return ceil($websitesCount * $customerGroupCount * self::MEMORY_SIZE_FOR_ONE_ROW);
5762
}
5863
}

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
*/
1212
class TemporaryTableStrategy implements \Magento\Framework\Indexer\Table\StrategyInterface
1313
{
14+
/**
15+
* Suffix for new temporary table
16+
*/
1417
const TEMP_SUFFIX = '_temp';
1518

1619
/**
@@ -31,7 +34,7 @@ class TemporaryTableStrategy implements \Magento\Framework\Indexer\Table\Strateg
3134
* @param \Magento\Framework\App\ResourceConnection $resource
3235
*/
3336
public function __construct(
34-
\Magento\Framework\Indexer\Table\Strategy $strategy,
37+
\Magento\Framework\Indexer\Table\StrategyInterface $strategy,
3538
\Magento\Framework\App\ResourceConnection $resource
3639
) {
3740
$this->strategy = $strategy;

app/code/Magento/Catalog/etc/di.xml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -947,14 +947,12 @@
947947
<argument name="indexerFrontendResource" xsi:type="object">Magento\Catalog\Model\ResourceModel\Product\Indexer\Price\FrontendResource</argument>
948948
</arguments>
949949
</type>
950-
<type name="Magento\Catalog\Model\ResourceModel\Product\Indexer\TemporaryTableStrategy" shared="false" />
951-
<type name="Magento\Catalog\Model\ResourceModel\Product\Indexer\Price\DefaultPrice">
950+
<type name="Magento\Catalog\Model\ResourceModel\Product\Indexer\TemporaryTableStrategy" shared="false">
952951
<arguments>
953-
<argument name="tableStrategy" xsi:type="object">Magento\Catalog\Model\ResourceModel\Product\Indexer\TemporaryTableStrategy</argument>
954-
<argument name="connectionName" xsi:type="string">indexer</argument>
952+
<argument name="strategy" xsi:type="object">Magento\Framework\Indexer\Table\Strategy</argument>
955953
</arguments>
956954
</type>
957-
<type name="Magento\Catalog\Model\ResourceModel\Product\Indexer\Eav\Source">
955+
<type name="Magento\Catalog\Model\ResourceModel\Product\Indexer\Price\DefaultPrice">
958956
<arguments>
959957
<argument name="tableStrategy" xsi:type="object">Magento\Catalog\Model\ResourceModel\Product\Indexer\TemporaryTableStrategy</argument>
960958
<argument name="connectionName" xsi:type="string">indexer</argument>

0 commit comments

Comments
 (0)