Skip to content

Commit c9b1de3

Browse files
author
Joan He
committed
Merge remote-tracking branch 'origin/MAGETWO-37820-preference-in-the-wrong-di-xml' into develop
2 parents 9542e30 + a33e4d3 commit c9b1de3

File tree

22 files changed

+119
-106
lines changed

22 files changed

+119
-106
lines changed

app/code/Magento/Bundle/Setup/InstallData.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface
8686
'input' => '',
8787
'class' => '',
8888
'source' => '',
89-
'global' => \Magento\Catalog\Model\ResourceModel\Eav\Attribute::SCOPE_GLOBAL,
89+
'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL,
9090
'visible' => true,
9191
'required' => true,
9292
'user_defined' => false,
@@ -112,7 +112,7 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface
112112
'input' => '',
113113
'class' => '',
114114
'source' => '',
115-
'global' => \Magento\Catalog\Model\ResourceModel\Eav\Attribute::SCOPE_GLOBAL,
115+
'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL,
116116
'visible' => false,
117117
'required' => true,
118118
'user_defined' => false,
@@ -137,7 +137,7 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface
137137
'input' => '',
138138
'class' => '',
139139
'source' => '',
140-
'global' => \Magento\Catalog\Model\ResourceModel\Eav\Attribute::SCOPE_GLOBAL,
140+
'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL,
141141
'visible' => false,
142142
'required' => true,
143143
'user_defined' => false,
@@ -164,7 +164,7 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface
164164
'input' => 'select',
165165
'class' => '',
166166
'source' => 'Magento\Bundle\Model\Product\Attribute\Source\Price\View',
167-
'global' => \Magento\Catalog\Model\ResourceModel\Eav\Attribute::SCOPE_GLOBAL,
167+
'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL,
168168
'visible' => true,
169169
'required' => true,
170170
'user_defined' => false,
@@ -190,7 +190,7 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface
190190
'input' => '',
191191
'class' => '',
192192
'source' => '',
193-
'global' => \Magento\Catalog\Model\ResourceModel\Eav\Attribute::SCOPE_GLOBAL,
193+
'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL,
194194
'visible' => false,
195195
'required' => true,
196196
'user_defined' => false,

app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Advanced.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -213,14 +213,14 @@ protected function _prepareForm()
213213
}
214214

215215
$scopes = [
216-
\Magento\Catalog\Model\ResourceModel\Eav\Attribute::SCOPE_STORE => __('Store View'),
217-
\Magento\Catalog\Model\ResourceModel\Eav\Attribute::SCOPE_WEBSITE => __('Website'),
218-
\Magento\Catalog\Model\ResourceModel\Eav\Attribute::SCOPE_GLOBAL => __('Global'),
216+
\Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_STORE => __('Store View'),
217+
\Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_WEBSITE => __('Website'),
218+
\Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL => __('Global'),
219219
];
220220

221221
if ($attributeObject->getAttributeCode() == 'status' || $attributeObject->getAttributeCode() == 'tax_class_id'
222222
) {
223-
unset($scopes[\Magento\Catalog\Model\ResourceModel\Eav\Attribute::SCOPE_STORE]);
223+
unset($scopes[\Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_STORE]);
224224
}
225225

226226
$fieldset->addField(

app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Grid.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ protected function _prepareColumns()
8383
'index' => 'is_global',
8484
'type' => 'options',
8585
'options' => [
86-
\Magento\Catalog\Model\ResourceModel\Eav\Attribute::SCOPE_STORE => __('Store View'),
87-
\Magento\Catalog\Model\ResourceModel\Eav\Attribute::SCOPE_WEBSITE => __('Web Site'),
88-
\Magento\Catalog\Model\ResourceModel\Eav\Attribute::SCOPE_GLOBAL => __('Global'),
86+
\Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_STORE => __('Store View'),
87+
\Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_WEBSITE => __('Web Site'),
88+
\Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL => __('Global'),
8989
],
9090
'align' => 'center'
9191
],

app/code/Magento/Catalog/Model/Attribute/Source/Scopes.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
namespace Magento\Catalog\Model\Attribute\Source;
77

8-
use \Magento\Catalog\Model\ResourceModel\Eav\Attribute;
8+
use \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface;
99

1010
class Scopes implements \Magento\Framework\Data\OptionSourceInterface
1111
{
@@ -16,15 +16,15 @@ public function toOptionArray()
1616
{
1717
return [
1818
[
19-
'value' => Attribute::SCOPE_STORE,
19+
'value' => ScopedAttributeInterface::SCOPE_STORE,
2020
'label' => __('Store View'),
2121
],
2222
[
23-
'value' => Attribute::SCOPE_WEBSITE,
23+
'value' => ScopedAttributeInterface::SCOPE_WEBSITE,
2424
'label' => __('Web Site'),
2525
],
2626
[
27-
'value' => Attribute::SCOPE_GLOBAL,
27+
'value' => ScopedAttributeInterface::SCOPE_GLOBAL,
2828
'label' => __('Global'),
2929
],
3030
];

app/code/Magento/Catalog/Model/Product/Attribute/Backend/Price.php

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

8+
use \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface;
9+
810
/**
911
* Catalog product price attribute backend model
1012
*
@@ -91,9 +93,9 @@ public function setAttribute($attribute)
9193
public function setScope($attribute)
9294
{
9395
if ($this->_helper->isPriceGlobal()) {
94-
$attribute->setIsGlobal(\Magento\Catalog\Model\ResourceModel\Eav\Attribute::SCOPE_GLOBAL);
96+
$attribute->setIsGlobal(ScopedAttributeInterface::SCOPE_GLOBAL);
9597
} else {
96-
$attribute->setIsGlobal(\Magento\Catalog\Model\ResourceModel\Eav\Attribute::SCOPE_WEBSITE);
98+
$attribute->setIsGlobal(ScopedAttributeInterface::SCOPE_WEBSITE);
9799
}
98100

99101
return $this;
@@ -118,7 +120,7 @@ public function afterSave($object)
118120
return $this;
119121
}
120122

121-
if ($this->getAttribute()->getIsGlobal() == \Magento\Catalog\Model\ResourceModel\Eav\Attribute::SCOPE_WEBSITE) {
123+
if ($this->getAttribute()->getIsGlobal() == ScopedAttributeInterface::SCOPE_WEBSITE) {
122124
$baseCurrency = $this->_config->getValue(
123125
\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE,
124126
'default'

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ protected function _clearUselessAttributeValues(\Magento\Framework\Model\Abstrac
8686

8787
if ($object->isScopeGlobal() && isset(
8888
$origData['is_global']
89-
) && \Magento\Catalog\Model\ResourceModel\Eav\Attribute::SCOPE_GLOBAL != $origData['is_global']
89+
) && \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL != $origData['is_global']
9090
) {
9191
$attributeStoreIds = array_keys($this->_storeManager->getStores());
9292
if (!empty($attributeStoreIds)) {

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,8 @@
3232
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
3333
*/
3434
class Attribute extends \Magento\Eav\Model\Entity\Attribute implements
35-
\Magento\Catalog\Api\Data\ProductAttributeInterface
35+
\Magento\Catalog\Api\Data\ProductAttributeInterface, \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface
3636
{
37-
const SCOPE_STORE = 0;
38-
39-
const SCOPE_GLOBAL = 1;
40-
41-
const SCOPE_WEBSITE = 2;
42-
4337
const MODULE_NAME = 'Magento_Catalog';
4438

4539
const ENTITY = 'catalog_eav_attribute';

app/code/Magento/Catalog/Model/ResourceModel/Setup/PropertyMapper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function map(array $input, $entityTypeId)
2626
'is_global' => $this->_getValue(
2727
$input,
2828
'global',
29-
\Magento\Catalog\Model\ResourceModel\Eav\Attribute::SCOPE_GLOBAL
29+
\Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL
3030
),
3131
'is_visible' => $this->_getValue($input, 'visible', 1),
3232
'is_searchable' => $this->_getValue($input, 'searchable', 0),

0 commit comments

Comments
 (0)