Skip to content

Commit 570110a

Browse files
author
Oleksandr Dubovyk
committed
Merge remote-tracking branch 'origin/develop' into PR
2 parents dbe32b4 + 5f4871b commit 570110a

File tree

168 files changed

+4211
-1754
lines changed

Some content is hidden

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

168 files changed

+4211
-1754
lines changed

.htaccess

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,10 +243,6 @@
243243
order allow,deny
244244
deny from all
245245
</Files>
246-
<Files CONTRIBUTOR_LICENSE_AGREEMENT.html>
247-
order allow,deny
248-
deny from all
249-
</Files>
250246
<Files COPYING.txt>
251247
order allow,deny
252248
deny from all

.htaccess.sample

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,6 @@
209209
order allow,deny
210210
deny from all
211211
</Files>
212-
<Files CONTRIBUTOR_LICENSE_AGREEMENT.html>
213-
order allow,deny
214-
deny from all
215-
</Files>
216212
<Files COPYING.txt>
217213
order allow,deny
218214
deny from all

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The Magento 2 development team will review all issues and contributions submitte
1010

1111
## Contribution requirements
1212

13-
1. Contributions must adhere to [Magento coding standards](http://devdocs.magento.com/guides/v1.0/coding-standards/bk-coding-standards.html).
13+
1. Contributions must adhere to [Magento coding standards](http://devdocs.magento.com/guides/v2.0/coding-standards/bk-coding-standards.html).
1414
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.
1515
3. Commits must be accompanied by meaningful commit messages.
1616
4. PRs which include bug fixing, must be accompanied with step-by-step description of how to reproduce the bug.
@@ -25,7 +25,7 @@ The Magento 2 development team will review all issues and contributions submitte
2525
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”.
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.
28-
2. Review the [Contributor License Agreement](https://github.com/magento/magento2/blob/master/CONTRIBUTOR_LICENSE_AGREEMENT.html) if this is your first time contributing.
28+
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/v1.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/v1.0/contributor-guide/CONTRIBUTING.html#pull_request).
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).
3131
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.

CONTRIBUTOR_LICENSE_AGREEMENT.html

Lines changed: 0 additions & 137 deletions
This file was deleted.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function render(\Magento\Framework\DataObject $row)
3030
$truncateLength = $this->getColumn()->getTruncate();
3131
}
3232
$text = $this->filterManager->truncate(parent::_getValue($row), ['length' => $truncateLength]);
33-
if ($this->getColumn()->getEscape()) {
33+
if (!$this->getColumn()->hasEscape() || $this->getColumn()->getEscape()) {
3434
$text = $this->escapeHtml($text);
3535
}
3636
if ($this->getColumn()->getNl2br()) {

app/code/Magento/Catalog/Model/CategoryRepository.php

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Magento\Framework\Exception\CouldNotSaveException;
1111
use Magento\Framework\Exception\NoSuchEntityException;
1212
use Magento\Framework\Exception\StateException;
13+
use Magento\Catalog\Api\Data\CategoryInterface;
1314

1415
class CategoryRepository implements \Magento\Catalog\Api\CategoryRepositoryInterface
1516
{
@@ -33,6 +34,11 @@ class CategoryRepository implements \Magento\Catalog\Api\CategoryRepositoryInter
3334
*/
3435
protected $categoryResource;
3536

37+
/**
38+
* @var \Magento\Framework\Model\Entity\MetadataPool
39+
*/
40+
protected $metadataPool;
41+
3642
/**
3743
* List of fields that can used config values in case when value does not defined directly
3844
*
@@ -44,15 +50,18 @@ class CategoryRepository implements \Magento\Catalog\Api\CategoryRepositoryInter
4450
* @param \Magento\Catalog\Model\CategoryFactory $categoryFactory
4551
* @param \Magento\Catalog\Model\ResourceModel\Category $categoryResource
4652
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
53+
* @param \Magento\Framework\Model\Entity\MetadataPool $metadataPool
4754
*/
4855
public function __construct(
4956
\Magento\Catalog\Model\CategoryFactory $categoryFactory,
5057
\Magento\Catalog\Model\ResourceModel\Category $categoryResource,
51-
\Magento\Store\Model\StoreManagerInterface $storeManager
58+
\Magento\Store\Model\StoreManagerInterface $storeManager,
59+
\Magento\Framework\Model\Entity\MetadataPool $metadataPool
5260
) {
5361
$this->categoryFactory = $categoryFactory;
5462
$this->categoryResource = $categoryResource;
5563
$this->storeManager = $storeManager;
64+
$this->metadataPool = $metadataPool;
5665
}
5766

5867
/**
@@ -61,10 +70,21 @@ public function __construct(
6170
public function save(\Magento\Catalog\Api\Data\CategoryInterface $category)
6271
{
6372
$existingData = $category->toFlatArray();
73+
6474
/** 'available_sort_by' should be set separately because fields of array type are destroyed by toFlatArray() */
6575
$existingData['available_sort_by'] = $category->getAvailableSortBy();
76+
6677
if ($category->getId()) {
78+
$metadata = $this->metadataPool->getMetadata(
79+
CategoryInterface::class
80+
);
81+
6782
$existingCategory = $this->get($category->getId());
83+
84+
$existingData[$metadata->getLinkField()] = $existingCategory->getData(
85+
$metadata->getLinkField()
86+
);
87+
6888
if (isset($existingData['image']) && is_array($existingData['image'])) {
6989
$existingData['image_additional_data'] = $existingData['image'];
7090
unset($existingData['image']);

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
/**
1313
* Class FlatTableBuilder
14+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1415
*/
1516
class FlatTableBuilder
1617
{
@@ -279,7 +280,7 @@ protected function _fillTemporaryFlatTable(array $tables, $storeId, $valueFieldS
279280
if (!empty($columnValueNames)) {
280281
$select->joinLeft(
281282
$temporaryValueTableName,
282-
"e.${linkField} = " . $temporaryValueTableName . ".${linkField}",
283+
"e.${linkField} = " . $temporaryValueTableName . ".entity_id",
283284
$columnValueNames
284285
);
285286
$allColumns = array_merge($allColumns, $columnValueNames);

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -378,11 +378,11 @@ protected function _reindexRows($changedIds = [])
378378
if (!empty($notCompositeIds)) {
379379
$select = $this->_connection->select()->from(
380380
['l' => $this->_defaultIndexerResource->getTable('catalog_product_relation')],
381-
'parent_id'
381+
''
382382
)->join(
383383
['e' => $this->_defaultIndexerResource->getTable('catalog_product_entity')],
384-
'e.entity_id = l.parent_id',
385-
['type_id']
384+
'e.' . $this->getProductIdFieldName() . ' = l.parent_id',
385+
['e.entity_id as parent_id', 'type_id']
386386
)->where(
387387
'l.child_id IN(?)',
388388
$notCompositeIds
@@ -422,11 +422,15 @@ protected function _reindexRows($changedIds = [])
422422
*/
423423
protected function _copyRelationIndexData($parentIds, $excludeIds = null)
424424
{
425+
$linkField = $this->getProductIdFieldName();
425426
$select = $this->_connection->select()->from(
426427
$this->_defaultIndexerResource->getTable('catalog_product_relation'),
427428
['child_id']
429+
)->join(
430+
['e' => $this->_defaultIndexerResource->getTable('catalog_product_entity')],
431+
'e.' . $linkField . ' = parent_id'
428432
)->where(
429-
'parent_id IN(?)',
433+
'e.entity_id IN(?)',
430434
$parentIds
431435
);
432436
if (!empty($excludeIds)) {

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

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -113,27 +113,20 @@ protected function _clearUselessAttributeValues(\Magento\Framework\Model\Abstrac
113113
/**
114114
* Delete entity
115115
*
116-
* @param \Magento\Framework\Model\AbstractModel $object
116+
* @param \Magento\Eav\Model\Entity\Attribute\AbstractAttribute $object
117117
* @return $this
118118
* @throws \Magento\Framework\Exception\LocalizedException
119119
*/
120-
public function deleteEntity(\Magento\Framework\Model\AbstractModel $object)
120+
public function deleteEntity(\Magento\Eav\Model\Entity\Attribute\AbstractAttribute $object)
121121
{
122122
if (!$object->getEntityAttributeId()) {
123123
return $this;
124124
}
125125

126-
$select = $this->getConnection()->select()->from(
127-
$this->getTable('eav_entity_attribute')
128-
)->where(
129-
'entity_attribute_id = ?',
130-
(int)$object->getEntityAttributeId()
131-
);
132-
$result = $this->getConnection()->fetchRow($select);
133-
126+
$result = $this->getEntityAttribute($object->getEntityAttributeId());
134127
if ($result) {
135128
$attribute = $this->_eavConfig->getAttribute(
136-
\Magento\Catalog\Model\Product::ENTITY,
129+
$object->getEntityTypeId(),
137130
$result['attribute_id']
138131
);
139132

0 commit comments

Comments
 (0)