Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit d9548f8

Browse files
author
Magento CICD
authored
merge magento/2.3-develop into magento-earl-grey/MAGETWO-91958
2 parents 402d565 + 943e2cd commit d9548f8

File tree

158 files changed

+3841
-472
lines changed

Some content is hidden

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

158 files changed

+3841
-472
lines changed

.github/CONTRIBUTING.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
11
# Contributing to Magento 2 code
22

33
Contributions to the Magento 2 codebase are done using the fork & pull model.
4-
This contribution model has contributors maintaining their own copy of the forked codebase (which can easily be synced with the main copy). The forked repository is then used to submit a request to the base repository to “pull” a set of changes (hence the phrase “pull request”).
4+
This contribution model has contributors maintaining their own copy of the forked codebase (which can easily be synced with the main copy). The forked repository is then used to submit a request to the base repository to “pull” a set of changes. For more information on pull requests please refer to [GitHub Help](https://help.github.com/articles/about-pull-requests/).
55

6-
Contributions can take the form of new components/features, changes to existing features, tests, documentation (such as developer guides, user guides, examples, or specifications), bug fixes, optimizations or just good suggestions.
6+
Contributions can take the form of new components or features, changes to existing features, tests, documentation (such as developer guides, user guides, examples, or specifications), bug fixes or optimizations.
77

8-
The Magento 2 development team will review all issues and contributions submitted by the community of developers in the first in, first out order. During the review we might require clarifications from the contributor. If there is no response from the contributor for two weeks, the issue is closed.
8+
The Magento 2 development team will review all issues and contributions submitted by the community of developers in the first in, first out order. During the review we might require clarifications from the contributor. If there is no response from the contributor within two weeks, the pull request will be closed.
99

1010

1111
## Contribution requirements
1212

13-
1. Contributions must adhere to [Magento coding standards](http://devdocs.magento.com/guides/v2.0/coding-standards/bk-coding-standards.html).
14-
2. Pull requests (PRs) must be accompanied by a meaningful description of their purpose. Comprehensive descriptions increase the chances of a pull request to be merged quickly and without additional clarification requests.
15-
3. Commits must be accompanied by meaningful commit messages.
16-
4. PRs which include bug fixing, must be accompanied with step-by-step description of how to reproduce the bug.
13+
1. Contributions must adhere to the [Magento coding standards](https://devdocs.magento.com/guides/v2.2/coding-standards/bk-coding-standards.html).
14+
2. Pull requests (PRs) must be accompanied by a meaningful description of their purpose. Comprehensive descriptions increase the chances of a pull request being merged quickly and without additional clarification requests.
15+
3. Commits must be accompanied by meaningful commit messages. Please see the [Magento Pull Request Template](https://github.com/magento/magento2/blob/2.2-develop/.github/PULL_REQUEST_TEMPLATE.md) for more information.
16+
4. PRs which include bug fixes must be accompanied with a step-by-step description of how to reproduce the bug.
1717
3. PRs which include new logic or new features must be submitted along with:
18-
* Unit/integration test coverage (we will be releasing more information on writing test coverage in the near future).
19-
* Proposed [documentation](http://devdocs.magento.com) update. Documentation contributions can be submitted [here](https://github.com/magento/devdocs).
20-
4. For large features or changes, please [open an issue](https://github.com/magento/magento2/issues) and discuss first. This may prevent duplicate or unnecessary effort, and it may gain you some additional contributors.
21-
5. All automated tests are passed successfully (all builds on [Travis CI](https://travis-ci.org/magento/magento2) must be green).
18+
* Unit/integration test coverage
19+
* Proposed [documentation](http://devdocs.magento.com) updates. Documentation contributions can be submitted via the [devdocs GitHub](https://github.com/magento/devdocs).
20+
4. For larger features or changes, please [open an issue](https://github.com/magento/magento2/issues) to discuss the proposed changes prior to development. This may prevent duplicate or unnecessary effort and allow other contributors to provide input.
21+
5. All automated tests must pass (all builds on [Travis CI](https://travis-ci.org/magento/magento2) must be green).
2222

2323
## Contribution process
2424

25-
If you are a new GitHub user, we recommend that you create your own [free github account](https://github.com/signup/free). By doing that, you will be able to collaborate with the Magento 2 development team, fork the Magento 2 project and be able to easily send pull requests.
25+
If you are a new GitHub user, we recommend that you create your own [free github account](https://github.com/signup/free). This will allow you to collaborate with the Magento 2 development team, fork the Magento 2 project and send pull requests.
2626

2727
1. Search current [listed issues](https://github.com/magento/magento2/issues) (open or closed) for similar proposals of intended contribution before starting work on a new contribution.
2828
2. Review the [Contributor License Agreement](https://magento.com/legaldocuments/mca) if this is your first time contributing.
2929
3. Create and test your work.
30-
4. Fork the Magento 2 repository according to [Fork a repository instructions](http://devdocs.magento.com/guides/v2.0/contributor-guide/contributing.html#fork) and when you are ready to send us a pull request – follow [Create a pull request instructions](http://devdocs.magento.com/guides/v2.0/contributor-guide/contributing.html#pull_request).
31-
5. Once your contribution is received, Magento 2 development team will review the contribution and collaborate with you as needed to improve the quality of the contribution.
30+
4. Fork the Magento 2 repository according to the [Fork A Repository instructions](http://devdocs.magento.com/guides/v2.2/contributor-guide/contributing.html#fork) and when you are ready to send us a pull request – follow the [Create A Pull Request instructions](http://devdocs.magento.com/guides/v2.2/contributor-guide/contributing.html#pull_request).
31+
5. Once your contribution is received the Magento 2 development team will review the contribution and collaborate with you as needed.
3232

3333
## Code of Conduct
3434

app/code/Magento/AdminNotification/Controller/Adminhtml/System/Message/ListAction.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,10 @@ public function execute()
6262
if (empty($result)) {
6363
$result[] = [
6464
'severity' => (string)\Magento\Framework\Notification\MessageInterface::SEVERITY_NOTICE,
65-
'text' => 'You have viewed and resolved all recent system notices. '
66-
. 'Please refresh the web page to clear the notice alert.',
65+
'text' => __(
66+
'You have viewed and resolved all recent system notices. '
67+
. 'Please refresh the web page to clear the notice alert.'
68+
)
6769
];
6870
}
6971
/** @var \Magento\Framework\Controller\Result\Json $resultJson */

app/code/Magento/AdminNotification/i18n/en_US.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,4 @@ Severity,Severity
4848
"Date Added","Date Added"
4949
Message,Message
5050
Actions,Actions
51+
"You have viewed and resolved all recent system notices. Please refresh the web page to clear the notice alert.","You have viewed and resolved all recent system notices. Please refresh the web page to clear the notice alert."

app/code/Magento/Backend/Block/Dashboard.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Dashboard extends \Magento\Backend\Block\Template
2020
/**
2121
* @var string
2222
*/
23-
protected $_template = 'dashboard/index.phtml';
23+
protected $_template = 'Magento_Backend::dashboard/index.phtml';
2424

2525
/**
2626
* @return void

app/code/Magento/Backend/Block/Dashboard/Graph.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class Graph extends \Magento\Backend\Block\Dashboard\AbstractDashboard
9090
/**
9191
* @var string
9292
*/
93-
protected $_template = 'dashboard/graph.phtml';
93+
protected $_template = 'Magento_Backend::dashboard/graph.phtml';
9494

9595
/**
9696
* Adminhtml dashboard data

app/code/Magento/Backend/Block/Dashboard/Grid.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended
1717
/**
1818
* @var string
1919
*/
20-
protected $_template = 'dashboard/grid.phtml';
20+
protected $_template = 'Magento_Backend::dashboard/grid.phtml';
2121

2222
/**
2323
* Setting default for every grid on dashboard

app/code/Magento/Backend/Block/Dashboard/Sales.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Sales extends \Magento\Backend\Block\Dashboard\Bar
1515
/**
1616
* @var string
1717
*/
18-
protected $_template = 'dashboard/salebar.phtml';
18+
protected $_template = 'Magento_Backend::dashboard/salebar.phtml';
1919

2020
/**
2121
* @var \Magento\Framework\Module\Manager

app/code/Magento/Backend/Block/Dashboard/Totals.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Totals extends \Magento\Backend\Block\Dashboard\Bar
1616
/**
1717
* @var string
1818
*/
19-
protected $_template = 'dashboard/totalbar.phtml';
19+
protected $_template = 'Magento_Backend::dashboard/totalbar.phtml';
2020

2121
/**
2222
* @var \Magento\Framework\Module\Manager

app/code/Magento/Backend/Block/Page/Copyright.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ class Copyright extends \Magento\Backend\Block\Template
1818
*
1919
* @var string
2020
*/
21-
protected $_template = 'page/copyright.phtml';
21+
protected $_template = 'Magento_Backend::page/copyright.phtml';
2222
}

app/code/Magento/Backend/Block/Page/Footer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Footer extends \Magento\Backend\Block\Template
1717
/**
1818
* @var string
1919
*/
20-
protected $_template = 'page/footer.phtml';
20+
protected $_template = 'Magento_Backend::page/footer.phtml';
2121

2222
/**
2323
* @var \Magento\Framework\App\ProductMetadataInterface

app/code/Magento/Backend/Block/Page/Header.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class Header extends \Magento\Backend\Block\Template
1818
/**
1919
* @var string
2020
*/
21-
protected $_template = 'page/header.phtml';
21+
protected $_template = 'Magento_Backend::page/header.phtml';
2222

2323
/**
2424
* Backend data

app/code/Magento/Backend/Block/Store/Switcher/Form/Renderer/Fieldset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Fieldset extends \Magento\Backend\Block\Template implements RendererInterf
2525
/**
2626
* @var string
2727
*/
28-
protected $_template = 'store/switcher/form/renderer/fieldset.phtml';
28+
protected $_template = 'Magento_Backend::store/switcher/form/renderer/fieldset.phtml';
2929

3030
/**
3131
* Retrieve an element

app/code/Magento/Backend/Block/Store/Switcher/Form/Renderer/Fieldset/Element.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class Element extends \Magento\Backend\Block\Widget\Form\Renderer\Fieldset\Eleme
2323
/**
2424
* @var string
2525
*/
26-
protected $_template = 'store/switcher/form/renderer/fieldset/element.phtml';
26+
protected $_template = 'Magento_Backend::store/switcher/form/renderer/fieldset/element.phtml';
2727

2828
/**
2929
* Retrieve an element

app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Currency.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,7 @@ public function __construct(
6868
$this->_storeManager = $storeManager;
6969
$this->_currencyLocator = $currencyLocator;
7070
$this->_localeCurrency = $localeCurrency;
71-
$defaultBaseCurrencyCode = $this->_scopeConfig->getValue(
72-
\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE,
73-
'default'
74-
);
71+
$defaultBaseCurrencyCode = $currencyLocator->getDefaultCurrency($this->_request);
7572
$this->_defaultBaseCurrency = $currencyFactory->create()->load($defaultBaseCurrencyCode);
7673
}
7774

app/code/Magento/Backend/etc/adminhtml/di.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,16 @@
139139
<type name="Magento\Backend\Model\Menu\Builder">
140140
<plugin name="SetupMenuBuilder" type="Magento\Backend\Model\Setup\MenuBuilder" />
141141
</type>
142-
<type name="Magento\Config\Model\Config\Structure\ConcealInProductionConfigList">
142+
<type name="Magento\Config\Model\Config\Structure\ElementVisibility\ConcealInProduction">
143143
<arguments>
144144
<argument name="configs" xsi:type="array">
145145
<item name="dev" xsi:type="const">Magento\Config\Model\Config\Structure\ElementVisibilityInterface::HIDDEN</item>
146+
</argument>
147+
</arguments>
148+
</type>
149+
<type name="Magento\Config\Model\Config\Structure\ElementVisibility\ConcealInProductionWithoutScdOnDemand">
150+
<arguments>
151+
<argument name="configs" xsi:type="array">
146152
<item name="general/locale/code" xsi:type="const">Magento\Config\Model\Config\Structure\ElementVisibilityInterface::DISABLED</item>
147153
</argument>
148154
</arguments>

app/code/Magento/BundleImportExport/Model/Import/Product/Type/Bundle.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,7 @@ public function saveData()
411411
$this->populateExistingOptions();
412412
$this->insertOptions();
413413
$this->insertSelections();
414+
$this->insertParentChildRelations();
414415
$this->clear();
415416
}
416417
}
@@ -659,6 +660,32 @@ protected function insertSelections()
659660
return $this;
660661
}
661662

663+
/**
664+
* Insert parent/child product relations
665+
*
666+
* @return \Magento\CatalogImportExport\Model\Import\Product\Type\AbstractType
667+
*/
668+
private function insertParentChildRelations()
669+
{
670+
foreach ($this->_cachedOptions as $productId => $options) {
671+
$childIds = [];
672+
foreach ($options as $option) {
673+
foreach ($option['selections'] as $selection) {
674+
if (!isset($selection['parent_product_id'])) {
675+
if (!isset($this->_cachedSkuToProducts[$selection['sku']])) {
676+
continue;
677+
}
678+
$childIds[] = $this->_cachedSkuToProducts[$selection['sku']];
679+
}
680+
}
681+
682+
$this->relationsDataSaver->saveProductRelations($productId, $childIds);
683+
}
684+
}
685+
686+
return $this;
687+
}
688+
662689
/**
663690
* Initialize attributes parameters for all attributes' sets.
664691
*

app/code/Magento/BundleImportExport/Model/Import/Product/Type/Bundle/RelationsDataSaver.php

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
*/
66
namespace Magento\BundleImportExport\Model\Import\Product\Type\Bundle;
77

8+
use Magento\Catalog\Model\ResourceModel\Product\Relation;
9+
use Magento\Framework\App\ObjectManager;
10+
811
/**
912
* A bundle product relations (options, selections, etc.) data saver.
1013
*
@@ -17,13 +20,22 @@ class RelationsDataSaver
1720
*/
1821
private $resource;
1922

23+
/**
24+
* @var Relation
25+
*/
26+
private $productRelation;
27+
2028
/**
2129
* @param \Magento\Framework\App\ResourceConnection $resource
30+
* @param Relation $productRelation
2231
*/
2332
public function __construct(
24-
\Magento\Framework\App\ResourceConnection $resource
33+
\Magento\Framework\App\ResourceConnection $resource,
34+
Relation $productRelation = null
2535
) {
26-
$this->resource = $resource;
36+
$this->resource = $resource;
37+
$this->productRelation = $productRelation
38+
?: ObjectManager::getInstance()->get(Relation::class);
2739
}
2840

2941
/**
@@ -92,4 +104,17 @@ public function saveSelections(array $selections)
92104
);
93105
}
94106
}
107+
108+
/**
109+
* Saves given parent/child relations.
110+
*
111+
* @param int $parentId
112+
* @param array $childIds
113+
*
114+
* @return void
115+
*/
116+
public function saveProductRelations($parentId, $childIds)
117+
{
118+
$this->productRelation->processRelations($parentId, $childIds);
119+
}
95120
}

app/code/Magento/BundleImportExport/Test/Unit/Model/Import/Product/Type/Bundle/RelationsDataSaverTest.php

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
namespace Magento\BundleImportExport\Test\Unit\Model\Import\Product\Type\Bundle;
88

99
use Magento\BundleImportExport\Model\Import\Product\Type\Bundle\RelationsDataSaver;
10+
use Magento\Catalog\Model\ResourceModel\Product\Relation;
1011
use Magento\Framework\App\ResourceConnection;
1112
use Magento\Framework\DB\Adapter\AdapterInterface;
1213

@@ -30,6 +31,11 @@ class RelationsDataSaverTest extends \PHPUnit\Framework\TestCase
3031
*/
3132
private $connectionMock;
3233

34+
/**
35+
* @var Relation|\PHPUnit_Framework_MockObject_MockObject
36+
*/
37+
private $productRelationMock;
38+
3339
protected function setUp()
3440
{
3541
$helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
@@ -39,12 +45,16 @@ protected function setUp()
3945
$this->connectionMock = $this->getMockBuilder(AdapterInterface::class)
4046
->disableOriginalConstructor()
4147
->getMock();
42-
$this->resourceMock->expects($this->once())->method('getConnection')->willReturn($this->connectionMock);
48+
49+
$this->productRelationMock = $this->getMockBuilder(Relation::class)
50+
->disableOriginalConstructor()
51+
->getMock();
4352

4453
$this->relationsDataSaver = $helper->getObject(
4554
RelationsDataSaver::class,
4655
[
47-
'resource' => $this->resourceMock
56+
'resource' => $this->resourceMock,
57+
'productRelation' => $this->productRelationMock
4858
]
4959
);
5060
}
@@ -53,7 +63,7 @@ public function testSaveOptions()
5363
{
5464
$options = [1, 2];
5565
$table_name= 'catalog_product_bundle_option';
56-
66+
$this->resourceMock->expects($this->once())->method('getConnection')->willReturn($this->connectionMock);
5767
$this->resourceMock->expects($this->once())
5868
->method('getTableName')
5969
->with('catalog_product_bundle_option')
@@ -78,6 +88,7 @@ public function testSaveOptionValues()
7888
$optionsValues = [1, 2];
7989
$table_name= 'catalog_product_bundle_option_value';
8090

91+
$this->resourceMock->expects($this->once())->method('getConnection')->willReturn($this->connectionMock);
8192
$this->resourceMock->expects($this->once())
8293
->method('getTableName')
8394
->with('catalog_product_bundle_option_value')
@@ -98,6 +109,7 @@ public function testSaveSelections()
98109
$selections = [1, 2];
99110
$table_name= 'catalog_product_bundle_selection';
100111

112+
$this->resourceMock->expects($this->once())->method('getConnection')->willReturn($this->connectionMock);
101113
$this->resourceMock->expects($this->once())
102114
->method('getTableName')
103115
->with('catalog_product_bundle_selection')
@@ -121,4 +133,16 @@ public function testSaveSelections()
121133

122134
$this->relationsDataSaver->saveSelections($selections);
123135
}
136+
137+
public function testSaveProductRelations()
138+
{
139+
$parentId = 1;
140+
$children = [2, 3];
141+
142+
$this->productRelationMock->expects($this->once())
143+
->method('processRelations')
144+
->with($parentId, $children);
145+
146+
$this->relationsDataSaver->saveProductRelations($parentId, $children);
147+
}
124148
}

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
use Magento\Catalog\Model\Indexer\Category\Product\AbstractAction;
1414
use Magento\Framework\Indexer\ScopeResolver\IndexScopeResolver as TableResolver;
1515

16+
/**
17+
* Class encapsulate logic of work with tables per store in Category Product indexer
18+
*/
1619
class TableMaintainer
1720
{
1821
/**
@@ -202,9 +205,14 @@ public function createMainTmpTable(int $storeId)
202205
* @param $storeId
203206
*
204207
* @return string
208+
*
209+
* @throws \Exception
205210
*/
206211
public function getMainTmpTable(int $storeId)
207212
{
213+
if (!isset($this->mainTmpTable[$storeId])) {
214+
throw new \Exception('Temporary table does not exist');
215+
}
208216
return $this->mainTmpTable[$storeId];
209217
}
210218
}

0 commit comments

Comments
 (0)