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

Commit

Permalink
Merge remote-tracking branch 'remotes/mainline/2.3-develop' into ENGC…
Browse files Browse the repository at this point in the history
…OM-1663-magento-graphql-ce-48
  • Loading branch information
Alex Paliarush committed May 30, 2018
2 parents fdacd0d + eaa8525 commit 2babeec
Show file tree
Hide file tree
Showing 34 changed files with 868 additions and 130 deletions.
28 changes: 14 additions & 14 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
# Contributing to Magento 2 code

Contributions to the Magento 2 codebase are done using the fork & pull model.
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”).
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/).

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.
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.

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.
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.


## Contribution requirements

1. Contributions must adhere to [Magento coding standards](http://devdocs.magento.com/guides/v2.0/coding-standards/bk-coding-standards.html).
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.
3. Commits must be accompanied by meaningful commit messages.
4. PRs which include bug fixing, must be accompanied with step-by-step description of how to reproduce the bug.
1. Contributions must adhere to the [Magento coding standards](https://devdocs.magento.com/guides/v2.2/coding-standards/bk-coding-standards.html).
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.
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.
4. PRs which include bug fixes must be accompanied with a step-by-step description of how to reproduce the bug.
3. PRs which include new logic or new features must be submitted along with:
* Unit/integration test coverage (we will be releasing more information on writing test coverage in the near future).
* Proposed [documentation](http://devdocs.magento.com) update. Documentation contributions can be submitted [here](https://github.com/magento/devdocs).
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.
5. All automated tests are passed successfully (all builds on [Travis CI](https://travis-ci.org/magento/magento2) must be green).
* Unit/integration test coverage
* Proposed [documentation](http://devdocs.magento.com) updates. Documentation contributions can be submitted via the [devdocs GitHub](https://github.com/magento/devdocs).
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.
5. All automated tests must pass (all builds on [Travis CI](https://travis-ci.org/magento/magento2) must be green).

## Contribution process

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.
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.

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.
2. Review the [Contributor License Agreement](https://magento.com/legaldocuments/mca) if this is your first time contributing.
3. Create and test your work.
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).
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.
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).
5. Once your contribution is received the Magento 2 development team will review the contribution and collaborate with you as needed.

## Code of Conduct

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,10 @@ public function execute()
if (empty($result)) {
$result[] = [
'severity' => (string)\Magento\Framework\Notification\MessageInterface::SEVERITY_NOTICE,
'text' => 'You have viewed and resolved all recent system notices. '
. 'Please refresh the web page to clear the notice alert.',
'text' => __(
'You have viewed and resolved all recent system notices. '
. 'Please refresh the web page to clear the notice alert.'
)
];
}
/** @var \Magento\Framework\Controller\Result\Json $resultJson */
Expand Down
1 change: 1 addition & 0 deletions app/code/Magento/AdminNotification/i18n/en_US.csv
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,4 @@ Severity,Severity
"Date Added","Date Added"
Message,Message
Actions,Actions
"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."
8 changes: 7 additions & 1 deletion app/code/Magento/Backend/etc/adminhtml/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,16 @@
<type name="Magento\Backend\Model\Menu\Builder">
<plugin name="SetupMenuBuilder" type="Magento\Backend\Model\Setup\MenuBuilder" />
</type>
<type name="Magento\Config\Model\Config\Structure\ConcealInProductionConfigList">
<type name="Magento\Config\Model\Config\Structure\ElementVisibility\ConcealInProduction">
<arguments>
<argument name="configs" xsi:type="array">
<item name="dev" xsi:type="const">Magento\Config\Model\Config\Structure\ElementVisibilityInterface::HIDDEN</item>
</argument>
</arguments>
</type>
<type name="Magento\Config\Model\Config\Structure\ElementVisibility\ConcealInProductionWithoutScdOnDemand">
<arguments>
<argument name="configs" xsi:type="array">
<item name="general/locale/code" xsi:type="const">Magento\Config\Model\Config\Structure\ElementVisibilityInterface::DISABLED</item>
</argument>
</arguments>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@ public function saveData()
$this->populateExistingOptions();
$this->insertOptions();
$this->insertSelections();
$this->insertParentChildRelations();
$this->clear();
}
}
Expand Down Expand Up @@ -659,6 +660,32 @@ protected function insertSelections()
return $this;
}

/**
* Insert parent/child product relations
*
* @return \Magento\CatalogImportExport\Model\Import\Product\Type\AbstractType
*/
private function insertParentChildRelations()
{
foreach ($this->_cachedOptions as $productId => $options) {
$childIds = [];
foreach ($options as $option) {
foreach ($option['selections'] as $selection) {
if (!isset($selection['parent_product_id'])) {
if (!isset($this->_cachedSkuToProducts[$selection['sku']])) {
continue;
}
$childIds[] = $this->_cachedSkuToProducts[$selection['sku']];
}
}

$this->relationsDataSaver->saveProductRelations($productId, $childIds);
}
}

return $this;
}

/**
* Initialize attributes parameters for all attributes' sets.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
*/
namespace Magento\BundleImportExport\Model\Import\Product\Type\Bundle;

use Magento\Catalog\Model\ResourceModel\Product\Relation;
use Magento\Framework\App\ObjectManager;

/**
* A bundle product relations (options, selections, etc.) data saver.
*
Expand All @@ -17,13 +20,22 @@ class RelationsDataSaver
*/
private $resource;

/**
* @var Relation
*/
private $productRelation;

/**
* @param \Magento\Framework\App\ResourceConnection $resource
* @param Relation $productRelation
*/
public function __construct(
\Magento\Framework\App\ResourceConnection $resource
\Magento\Framework\App\ResourceConnection $resource,
Relation $productRelation = null
) {
$this->resource = $resource;
$this->resource = $resource;
$this->productRelation = $productRelation
?: ObjectManager::getInstance()->get(Relation::class);
}

/**
Expand Down Expand Up @@ -92,4 +104,17 @@ public function saveSelections(array $selections)
);
}
}

/**
* Saves given parent/child relations.
*
* @param int $parentId
* @param array $childIds
*
* @return void
*/
public function saveProductRelations($parentId, $childIds)
{
$this->productRelation->processRelations($parentId, $childIds);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
namespace Magento\BundleImportExport\Test\Unit\Model\Import\Product\Type\Bundle;

use Magento\BundleImportExport\Model\Import\Product\Type\Bundle\RelationsDataSaver;
use Magento\Catalog\Model\ResourceModel\Product\Relation;
use Magento\Framework\App\ResourceConnection;
use Magento\Framework\DB\Adapter\AdapterInterface;

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

/**
* @var Relation|\PHPUnit_Framework_MockObject_MockObject
*/
private $productRelationMock;

protected function setUp()
{
$helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
Expand All @@ -39,12 +45,16 @@ protected function setUp()
$this->connectionMock = $this->getMockBuilder(AdapterInterface::class)
->disableOriginalConstructor()
->getMock();
$this->resourceMock->expects($this->once())->method('getConnection')->willReturn($this->connectionMock);

$this->productRelationMock = $this->getMockBuilder(Relation::class)
->disableOriginalConstructor()
->getMock();

$this->relationsDataSaver = $helper->getObject(
RelationsDataSaver::class,
[
'resource' => $this->resourceMock
'resource' => $this->resourceMock,
'productRelation' => $this->productRelationMock
]
);
}
Expand All @@ -53,7 +63,7 @@ public function testSaveOptions()
{
$options = [1, 2];
$table_name= 'catalog_product_bundle_option';

$this->resourceMock->expects($this->once())->method('getConnection')->willReturn($this->connectionMock);
$this->resourceMock->expects($this->once())
->method('getTableName')
->with('catalog_product_bundle_option')
Expand All @@ -78,6 +88,7 @@ public function testSaveOptionValues()
$optionsValues = [1, 2];
$table_name= 'catalog_product_bundle_option_value';

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

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

$this->relationsDataSaver->saveSelections($selections);
}

public function testSaveProductRelations()
{
$parentId = 1;
$children = [2, 3];

$this->productRelationMock->expects($this->once())
->method('processRelations')
->with($parentId, $children);

$this->relationsDataSaver->saveProductRelations($parentId, $children);
}
}
14 changes: 0 additions & 14 deletions app/code/Magento/Catalog/Model/ResourceModel/Eav/Attribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -895,18 +895,4 @@ public function setIsFilterableInGrid($isFilterableInGrid)
$this->setData(self::IS_FILTERABLE_IN_GRID, $isFilterableInGrid);
return $this;
}

/**
* @return \Magento\Eav\Api\Data\AttributeExtensionInterface
*/
public function getExtensionAttributes()
{
$extensionAttributes = $this->_getExtensionAttributes();
if (null === $extensionAttributes) {
/** @var \Magento\Eav\Api\Data\AttributeExtensionInterface $extensionAttributes */
$extensionAttributes = $this->eavAttributeFactory->create();
$this->setExtensionAttributes($extensionAttributes);
}
return $extensionAttributes;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
* Defines status of visibility of form elements on Stores > Settings > Configuration page
* in Admin Panel in Production mode.
* @api
* @since 100.2.0
* @deprecated class location was changed
* @see \Magento\Config\Model\Config\Structure\ElementVisibility\ConcealInProduction
*/
class ConcealInProductionConfigList implements ElementVisibilityInterface
{
Expand Down Expand Up @@ -54,7 +55,7 @@ public function __construct(State $state, array $configs = [])

/**
* @inheritdoc
* @since 100.2.0
* @deprecated
*/
public function isHidden($path)
{
Expand All @@ -67,7 +68,7 @@ public function isHidden($path)

/**
* @inheritdoc
* @since 100.2.0
* @deprecated
*/
public function isDisabled($path)
{
Expand Down
Loading

0 comments on commit 2babeec

Please sign in to comment.