Skip to content

Commit 47fe5dd

Browse files
committed
Merge branch 'MC-18459' of https://github.com/magento-mpi/magento2ce into PR-2019-12-06
2 parents 57a2aad + 6991eba commit 47fe5dd

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

app/code/Magento/Catalog/Helper/Product/Edit/Action/Attribute.php

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
67

7-
/**
8-
* Adminhtml catalog product action attribute update helper
9-
*/
108
namespace Magento\Catalog\Helper\Product\Edit\Action;
119

1210
/**
13-
* Class Attribute
11+
* Adminhtml catalog product action attribute update helper.
12+
*
1413
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
14+
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
1515
*/
1616
class Attribute extends \Magento\Backend\Helper\Data
1717
{
@@ -32,7 +32,7 @@ class Attribute extends \Magento\Backend\Helper\Data
3232
/**
3333
* Excluded from batch update attribute codes
3434
*
35-
* @var string[]
35+
* @var array
3636
*/
3737
protected $_excludedAttributes = ['url_key'];
3838

@@ -92,6 +92,7 @@ public function __construct(
9292

9393
/**
9494
* Return product collection with selected product filter
95+
*
9596
* Product collection didn't load
9697
*
9798
* @return \Magento\Catalog\Model\ResourceModel\Product\Collection
@@ -171,8 +172,8 @@ public function getAttributes()
171172
$this->getProductsSetIds()
172173
);
173174

174-
if ($this->_excludedAttributes) {
175-
$this->_attributes->addFieldToFilter('attribute_code', ['nin' => $this->_excludedAttributes]);
175+
if ($excludedAttributes = $this->getExcludedAttributes()) {
176+
$this->_attributes->addFieldToFilter('attribute_code', ['nin' => $excludedAttributes]);
176177
}
177178

178179
// check product type apply to limitation and remove attributes that impossible to change in mass-update
@@ -193,11 +194,24 @@ public function getAttributes()
193194
}
194195

195196
/**
197+
* Gets website id.
198+
*
196199
* @param int $storeId
197200
* @return int
201+
* @throws \Magento\Framework\Exception\NoSuchEntityException
198202
*/
199203
public function getStoreWebsiteId($storeId)
200204
{
201205
return $this->_storeManager->getStore($storeId)->getWebsiteId();
202206
}
207+
208+
/**
209+
* Retrieve excluded attributes.
210+
*
211+
* @return array
212+
*/
213+
public function getExcludedAttributes(): array
214+
{
215+
return $this->_excludedAttributes;
216+
}
203217
}

0 commit comments

Comments
 (0)