Skip to content

Commit 61c3396

Browse files
committed
Merge branch 'develop' of github.corp.magento.com:magento2/magento2ce into MAGETWO-49453
2 parents 3e96b4b + cf7df72 commit 61c3396

File tree

129 files changed

+6167
-2140
lines changed

Some content is hidden

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

129 files changed

+6167
-2140
lines changed

app/code/Magento/Backend/Block/System/Store/Edit/Form/Website.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,9 @@ protected function _prepareStoreFieldset(\Magento\Framework\Data\Form $form)
108108
);
109109
}
110110

111-
if (!$websiteModel->getIsDefault() && $websiteModel->getStoresCount()) {
111+
$hasOnlyDefaultStore = $websiteModel->getStoresCount() == 1 &&
112+
array_key_exists(\Magento\Store\Model\Store::DEFAULT_STORE_ID, $websiteModel->getStoreIds());
113+
if (!$websiteModel->getIsDefault() && $websiteModel->getStoresCount() && !$hasOnlyDefaultStore) {
112114
$fieldset->addField(
113115
'is_default',
114116
'checkbox',

app/code/Magento/Backend/Helper/Dashboard/Order.php

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*/
66
namespace Magento\Backend\Helper\Dashboard;
77

8+
use Magento\Framework\App\ObjectManager;
9+
810
/**
911
* Adminhtml dashboard helper for orders
1012
*/
@@ -15,6 +17,11 @@ class Order extends \Magento\Backend\Helper\Dashboard\AbstractDashboard
1517
*/
1618
protected $_orderCollection;
1719

20+
/**
21+
* @var \Magento\Store\Model\StoreManagerInterface
22+
*/
23+
protected $_storeManager;
24+
1825
/**
1926
* @param \Magento\Framework\App\Helper\Context $context
2027
* @param \Magento\Reports\Model\ResourceModel\Order\Collection $orderCollection
@@ -24,9 +31,18 @@ public function __construct(
2431
\Magento\Reports\Model\ResourceModel\Order\Collection $orderCollection
2532
) {
2633
$this->_orderCollection = $orderCollection;
27-
parent::__construct(
28-
$context
29-
);
34+
parent::__construct($context);
35+
}
36+
37+
/**
38+
* @return \Magento\SalesRule\Model\RuleFactory
39+
* @deprecated
40+
*/
41+
public function getStoreManager()
42+
{
43+
if ($this->_storeManager instanceof \Magento\Store\Model\StoreManagerInterface) {
44+
$this->_storeManager = ObjectManager::getInstance()->get('\Magento\Store\Model\StoreManagerInterface');
45+
}
3046
}
3147

3248
/**

app/code/Magento/Backend/Model/Url.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ class Url extends \Magento\Framework\Url implements \Magento\Backend\Model\UrlIn
8686
* @param \Magento\Framework\Url\RouteParamsResolverFactory $routeParamsResolverFactory
8787
* @param \Magento\Framework\Url\QueryParamsResolverInterface $queryParamsResolver
8888
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
89+
* @param \Magento\Framework\Url\RouteParamsPreprocessorInterface $routeParamsPreprocessor
8990
* @param string $scopeType
9091
* @param \Magento\Backend\Helper\Data $backendHelper
9192
* @param Menu\Config $menuConfig
@@ -108,6 +109,7 @@ public function __construct(
108109
\Magento\Framework\Url\RouteParamsResolverFactory $routeParamsResolverFactory,
109110
\Magento\Framework\Url\QueryParamsResolverInterface $queryParamsResolver,
110111
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
112+
\Magento\Framework\Url\RouteParamsPreprocessorInterface $routeParamsPreprocessor,
111113
$scopeType,
112114
\Magento\Backend\Helper\Data $backendHelper,
113115
\Magento\Backend\Model\Menu\Config $menuConfig,
@@ -129,6 +131,7 @@ public function __construct(
129131
$routeParamsResolverFactory,
130132
$queryParamsResolver,
131133
$scopeConfig,
134+
$routeParamsPreprocessor,
132135
$scopeType,
133136
$data
134137
);

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

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@
55
*/
66
namespace Magento\Catalog\Model\Indexer\Product\Flat;
77

8+
use Magento\Catalog\Api\Data\ProductInterface;
89
use Magento\Framework\App\ResourceConnection;
10+
use Magento\Framework\Model\Entity\MetadataPool;
911

1012
/**
1113
* Abstract action reindex class
12-
*
14+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1315
*/
1416
abstract class AbstractAction
1517
{
@@ -72,6 +74,12 @@ abstract class AbstractAction
7274
protected $_flatTableBuilder;
7375

7476
/**
77+
* @var MetadataPool
78+
*/
79+
private $metadataPool;
80+
81+
/**
82+
* @param MetadataPool $metadataPool
7583
* @param \Magento\Framework\App\ResourceConnection $resource
7684
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
7785
* @param \Magento\Catalog\Helper\Product\Flat\Indexer $productHelper
@@ -80,6 +88,7 @@ abstract class AbstractAction
8088
* @param FlatTableBuilder $flatTableBuilder
8189
*/
8290
public function __construct(
91+
MetadataPool $metadataPool,
8392
\Magento\Framework\App\ResourceConnection $resource,
8493
\Magento\Store\Model\StoreManagerInterface $storeManager,
8594
\Magento\Catalog\Helper\Product\Flat\Indexer $productHelper,
@@ -93,6 +102,7 @@ public function __construct(
93102
$this->_connection = $resource->getConnection();
94103
$this->_tableBuilder = $tableBuilder;
95104
$this->_flatTableBuilder = $flatTableBuilder;
105+
$this->metadataPool = $metadataPool;
96106
}
97107

98108
/**
@@ -194,6 +204,8 @@ protected function _updateRelationProducts($storeId, $productIds = null)
194204
return $this;
195205
}
196206

207+
$metadata = $this->metadataPool->getMetadata(ProductInterface::class);
208+
197209
foreach ($this->_getProductTypeInstances() as $typeInstance) {
198210
/** @var $typeInstance \Magento\Catalog\Model\Product\Type\AbstractType */
199211
if (!$typeInstance->isComposite(null)) {
@@ -210,7 +222,11 @@ protected function _updateRelationProducts($storeId, $productIds = null)
210222
/** @var $select \Magento\Framework\DB\Select */
211223
$select = $this->_connection->select()->from(
212224
['t' => $this->_productIndexerHelper->getTable($relation->getTable())],
213-
[$relation->getParentFieldName(), $relation->getChildFieldName(), new \Zend_Db_Expr('1')]
225+
[$relation->getChildFieldName(), new \Zend_Db_Expr('1')]
226+
)->join(
227+
['entity_table' => $this->_connection->getTableName('catalog_product_entity')],
228+
'entity_table.' . $metadata->getLinkField() . 't.' . $relation->getParentFieldName(),
229+
[$relation->getParentFieldName() => 'entity_table.entity_id']
214230
)->join(
215231
['e' => $this->_productIndexerHelper->getFlatTableName($storeId)],
216232
"e.entity_id = t.{$relation->getChildFieldName()}",
@@ -222,7 +238,7 @@ protected function _updateRelationProducts($storeId, $productIds = null)
222238
if ($productIds !== null) {
223239
$cond = [
224240
$this->_connection->quoteInto("{$relation->getChildFieldName()} IN(?)", $productIds),
225-
$this->_connection->quoteInto("{$relation->getParentFieldName()} IN(?)", $productIds),
241+
$this->_connection->quoteInto("entity_table.entity_id IN(?)", $productIds),
226242
];
227243

228244
$select->where(implode(' OR ', $cond));
@@ -247,6 +263,8 @@ protected function _cleanRelationProducts($storeId)
247263
return $this;
248264
}
249265

266+
$metadata = $this->metadataPool->getMetadata(ProductInterface::class);
267+
250268
foreach ($this->_getProductTypeInstances() as $typeInstance) {
251269
/** @var $typeInstance \Magento\Catalog\Model\Product\Type\AbstractType */
252270
if (!$typeInstance->isComposite(null)) {
@@ -258,11 +276,15 @@ protected function _cleanRelationProducts($storeId)
258276
$select = $this->_connection->select()->distinct(
259277
true
260278
)->from(
261-
$this->_productIndexerHelper->getTable($relation->getTable()),
262-
"{$relation->getParentFieldName()}"
279+
['t' => $this->_productIndexerHelper->getTable($relation->getTable())],
280+
[]
281+
)->join(
282+
['entity_table' => $this->_connection->getTableName('catalog_product_entity')],
283+
'entity_table.' . $metadata->getLinkField() . 't.' . $relation->getParentFieldName(),
284+
[$relation->getParentFieldName() => 'entity_table.entity_id']
263285
);
264286
$joinLeftCond = [
265-
"e.entity_id = t.{$relation->getParentFieldName()}",
287+
"e.entity_id = entity_table.entity_id",
266288
"e.child_id = t.{$relation->getChildFieldName()}",
267289
];
268290
if ($relation->getWhere() !== null) {

app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Row.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
use Magento\Catalog\Model\Indexer\Product\Flat\FlatTableBuilder;
99
use Magento\Catalog\Model\Indexer\Product\Flat\TableBuilder;
10+
use Magento\Framework\Model\Entity\MetadataPool;
1011

1112
/**
1213
* Class Row reindex action
@@ -24,6 +25,7 @@ class Row extends \Magento\Catalog\Model\Indexer\Product\Flat\AbstractAction
2425
protected $flatItemEraser;
2526

2627
/**
28+
* @param MetadataPool $metadataPool
2729
* @param \Magento\Framework\App\ResourceConnection $resource
2830
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
2931
* @param \Magento\Catalog\Helper\Product\Flat\Indexer $productHelper
@@ -34,6 +36,7 @@ class Row extends \Magento\Catalog\Model\Indexer\Product\Flat\AbstractAction
3436
* @param Eraser $flatItemEraser
3537
*/
3638
public function __construct(
39+
MetadataPool $metadataPool,
3740
\Magento\Framework\App\ResourceConnection $resource,
3841
\Magento\Store\Model\StoreManagerInterface $storeManager,
3942
\Magento\Catalog\Helper\Product\Flat\Indexer $productHelper,
@@ -44,6 +47,7 @@ public function __construct(
4447
Eraser $flatItemEraser
4548
) {
4649
parent::__construct(
50+
$metadataPool,
4751
$resource,
4852
$storeManager,
4953
$productHelper,

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
use Magento\Catalog\Model\Indexer\Product\Flat\FlatTableBuilder;
99
use Magento\Catalog\Model\Indexer\Product\Flat\TableBuilder;
10+
use Magento\Framework\Model\Entity\MetadataPool;
1011

1112
/**
1213
* Class Rows reindex action for mass actions
@@ -20,6 +21,7 @@ class Rows extends \Magento\Catalog\Model\Indexer\Product\Flat\AbstractAction
2021
protected $flatItemEraser;
2122

2223
/**
24+
* @param MetadataPool $metadataPool
2325
* @param \Magento\Framework\App\ResourceConnection $resource
2426
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
2527
* @param \Magento\Catalog\Helper\Product\Flat\Indexer $productHelper
@@ -29,6 +31,7 @@ class Rows extends \Magento\Catalog\Model\Indexer\Product\Flat\AbstractAction
2931
* @param Eraser $flatItemEraser
3032
*/
3133
public function __construct(
34+
MetadataPool $metadataPool,
3235
\Magento\Framework\App\ResourceConnection $resource,
3336
\Magento\Store\Model\StoreManagerInterface $storeManager,
3437
\Magento\Catalog\Helper\Product\Flat\Indexer $productHelper,
@@ -38,6 +41,7 @@ public function __construct(
3841
Eraser $flatItemEraser
3942
) {
4043
parent::__construct(
44+
$metadataPool,
4145
$resource,
4246
$storeManager,
4347
$productHelper,

app/code/Magento/Catalog/Ui/Component/Listing/Columns/Websites.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public function __construct(
4343

4444
/**
4545
* {@inheritdoc}
46+
* @deprecated
4647
*/
4748
public function prepareDataSource(array $dataSource)
4849
{
@@ -63,15 +64,16 @@ public function prepareDataSource(array $dataSource)
6364

6465
return $dataSource;
6566
}
66-
67+
6768
/**
6869
* Prepare component configuration
6970
* @return void
7071
*/
7172
public function prepare()
7273
{
73-
if (!$this->storeManager->isSingleStoreMode()) {
74-
parent::prepare();
74+
parent::prepare();
75+
if ($this->storeManager->isSingleStoreMode()) {
76+
$this->_data['config']['componentDisabled'] = true;
7577
}
7678
}
7779
}

app/code/Magento/Catalog/view/adminhtml/ui_component/product_listing.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@
230230
</item>
231231
</argument>
232232
</column>
233-
<column name="websites">
233+
<column name="websites" class="Magento\Catalog\Ui\Component\Listing\Columns\Websites">
234234
<argument name="data" xsi:type="array">
235235
<item name="options" xsi:type="object">Magento\Store\Model\ResourceModel\Website\Collection</item>
236236
<item name="config" xsi:type="array">

app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/Conditions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ protected function addTabToForm($model, $fieldsetId = 'conditions_fieldset', $fo
153153

154154
$renderer = $this->_rendererFieldset->setTemplate('Magento_CatalogRule::promo/fieldset.phtml')
155155
->setNewChildUrl($newChildUrl)
156-
->setConditionsFieldSetId($model->getConditionsFieldSetId($formName));
156+
->setFieldSetId($model->getConditionsFieldSetId($formName));
157157

158158
$fieldset = $form->addFieldset(
159159
$fieldsetId,

app/code/Magento/CatalogRule/view/adminhtml/templates/promo/fieldset.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
/**@var \Magento\Backend\Block\Widget\Form\Renderer\Fieldset $block */
1010
?>
1111
<?php $_element = $block->getElement() ?>
12-
<?php $_jsObjectName = $block->getConditionsFieldSetId() != null ? $block->getConditionsFieldSetId() : $_element->getHtmlId() ?>
12+
<?php $_jsObjectName = $block->getFieldSetId() != null ? $block->getFieldSetId() : $_element->getHtmlId() ?>
1313
<div class="rule-tree">
1414
<fieldset id="<?php /* @escapeNotVerified */ echo $_jsObjectName ?>" <?php /* @escapeNotVerified */ echo $_element->serialize(['class']) ?> class="fieldset">
1515
<legend class="legend"><span><?php /* @escapeNotVerified */ echo $_element->getLegend() ?></span></legend>

0 commit comments

Comments
 (0)