Skip to content

Commit 54155e9

Browse files
committed
Merge remote-tracking branch 'mainline-ce/develop' into MAGETWO-35250-URL-Rewrite-Is-Not-Removed-After-Removing-Category
2 parents 21ed6ae + 7ab8211 commit 54155e9

File tree

24 files changed

+441
-459
lines changed

24 files changed

+441
-459
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*/
66
namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Tab;
77

8+
use Magento\Framework\Api\SimpleDataObjectConverter;
9+
810
/**
911
* Product inventory data
1012
*/
@@ -133,7 +135,7 @@ public function getFieldValue($field)
133135
{
134136
$stockItem = $this->getStockItem();
135137
if ($stockItem->getItemId()) {
136-
$method = 'get' . \Magento\Framework\Api\SimpleDataObjectConverter::snakeCaseToUpperCamelCase($field);
138+
$method = 'get' . SimpleDataObjectConverter::snakeCaseToUpperCamelCase($field);
137139
if (method_exists($stockItem, $method)) {
138140
return $stockItem->{$method}();
139141
}
@@ -149,7 +151,7 @@ public function getConfigFieldValue($field)
149151
{
150152
$stockItem = $this->getStockItem();
151153
if ($stockItem->getItemId()) {
152-
$method = 'getUseConfig' . \Magento\Framework\Api\SimpleDataObjectConverter::snakeCaseToUpperCamelCase(
154+
$method = 'getUseConfig' . SimpleDataObjectConverter::snakeCaseToUpperCamelCase(
153155
$field
154156
);
155157
if (method_exists($stockItem, $method)) {

app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/action/inventory.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
class="select" disabled="disabled">
5151
<option value="1"><?php echo __('Yes') ?></option>
5252
<option
53-
value="0"<?php if ($block->getConfigFieldValue('manage_stock') == 0): ?> selected="selected"<?php endif; ?>><?php echo __('No') ?></option>
53+
value="0"<?php if ($block->getFieldValue('manage_stock') == 0): ?> selected="selected"<?php endif; ?>><?php echo __('No') ?></option>
5454
</select>
5555
</div>
5656
<div class="field choice">

app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/tab/inventory.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<div class="control">
2525
<select id="inventory_manage_stock" name="<?php echo $block->getFieldSuffix() ?>[stock_data][manage_stock]" <?php echo $_readonly;?>>
2626
<option value="1"><?php echo __('Yes') ?></option>
27-
<option value="0"<?php if ($block->getConfigFieldValue('manage_stock') == 0): ?> selected="selected"<?php endif; ?>><?php echo __('No') ?></option>
27+
<option value="0"<?php if ($block->getFieldValue('manage_stock') == 0): ?> selected="selected"<?php endif; ?>><?php echo __('No') ?></option>
2828
</select>
2929
<input type="hidden" id="inventory_manage_stock_default" value="<?php echo $block->getDefaultConfigValue('manage_stock'); ?>">
3030
<?php $_checked = ($block->getFieldValue('use_config_manage_stock') || $block->IsNew()) ? 'checked="checked"' : '' ?>

app/code/Magento/Catalog/view/adminhtml/templates/product/edit/attribute/search.phtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<ul data-mage-init='{"menu":[]}'>
2626
<% if (data.items.length) { %>
2727
<% _.each(data.items, function(value){ %>
28-
<li <%- data.optionData(value) %>><a href="#"><%- value.label %></a></li>
28+
<li <%= data.optionData(value) %>><a href="#"><%- value.label %></a></li>
2929
<% }); %>
3030
<% } else { %><span class="mage-suggest-no-records"><%- data.noRecordsText %></span><% } %>
3131
</ul>
@@ -50,7 +50,7 @@
5050
data: {'template_id': data.id}
5151
});
5252
});
53-
53+
5454
$suggest.mage('suggest', <?php echo $this->helper('Magento\Framework\Json\Helper\Data')->jsonEncode($block->getSelectorOptions())?>)
5555
.on('suggestselect', function (e, ui) {
5656
$(this).val('');

app/code/Magento/Downloadable/Block/Customer/Products/ListProducts.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ protected function _prepareLayout()
9999
'downloadable.customer.products.pager'
100100
)->setCollection(
101101
$this->getItems()
102-
);
102+
)->setPath('downloadable/customer/products');
103103
$this->setChild('pager', $pager);
104104
$this->getItems()->load();
105105
foreach ($this->getItems() as $item) {

app/code/Magento/Eav/Model/EavCustomAttributeTypeLocator.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
use Magento\Framework\Exception\NoSuchEntityException;
1111
use Magento\Framework\Webapi\CustomAttributeTypeLocatorInterface;
1212

13+
/**
14+
* Class to locate types for Eav custom attributes
15+
*/
1316
class EavCustomAttributeTypeLocator implements CustomAttributeTypeLocatorInterface
1417
{
1518
/**
@@ -32,7 +35,22 @@ class EavCustomAttributeTypeLocator implements CustomAttributeTypeLocatorInterfa
3235
*
3336
* @param AttributeRepositoryInterface $attributeRepository
3437
* @param array $serviceEntityTypeMap
38+
* <pre>
39+
* [
40+
* 'ServiceInterfaceA' => 'EavEntityType1',
41+
* 'ServiceInterfaceB' => 'EavEntityType2'
42+
* ]
43+
* </pre>
3544
* @param array $serviceBackendModelDataInterfaceMap
45+
* <pre>
46+
* [
47+
* 'ServiceInterfaceA' => ['BackendType1' => 'ServiceDataInterface1'],
48+
* 'ServiceInterfaceB' => [
49+
* 'BackendType2' => 'ServiceDataInterface2',
50+
* 'BackendType3' => 'ServiceDataInterface3'
51+
* ]
52+
* ]
53+
* </pre>
3654
*/
3755
public function __construct(
3856
AttributeRepositoryInterface $attributeRepository,
@@ -69,4 +87,22 @@ public function getType($attributeCode, $serviceClass)
6987

7088
return $dataInterface;
7189
}
90+
91+
/**
92+
* {@inheritdoc}
93+
*/
94+
public function getAllServiceDataInterfaces()
95+
{
96+
$dataInterfaceArray = [];
97+
if (!$this->serviceBackendModelDataInterfaceMap) {
98+
return [];
99+
} else {
100+
foreach ($this->serviceBackendModelDataInterfaceMap as $serviceArray) {
101+
foreach ($serviceArray as $dataInterface) {
102+
$dataInterfaceArray[] = $dataInterface;
103+
}
104+
}
105+
}
106+
return $dataInterfaceArray;
107+
}
72108
}

app/code/Magento/Eav/Test/Unit/Model/EavCustomAttributeTypeLocatorTest.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,4 +147,26 @@ public function getTypeDataProvider()
147147
]
148148
];
149149
}
150+
151+
public function testGetAllServiceDataInterfaceEmpty()
152+
{
153+
$this->eavCustomAttributeTypeLocator = new EavCustomAttributeTypeLocator($this->attributeRepository);
154+
$this->assertEmpty($this->eavCustomAttributeTypeLocator->getAllServiceDataInterfaces());
155+
}
156+
157+
public function testGetAllServiceDataInterface()
158+
{
159+
$serviceBackendModelDataInterfaceMapData = [
160+
'ServiceA' => ['BackendA' => 'ServiceDataInterfaceA'],
161+
'ServiceB' => ['BackendB' => 'ServiceDataInterfaceB', 'BackendC' => 'ServiceDataInterfaceC'],
162+
'ServiceC' => ['BackendD' => 'ServiceDataInterfaceD']
163+
];
164+
$this->eavCustomAttributeTypeLocator = new EavCustomAttributeTypeLocator(
165+
$this->attributeRepository, [], $serviceBackendModelDataInterfaceMapData
166+
);
167+
$this->assertEquals(
168+
['ServiceDataInterfaceA', 'ServiceDataInterfaceB', 'ServiceDataInterfaceC', 'ServiceDataInterfaceD'],
169+
$this->eavCustomAttributeTypeLocator->getAllServiceDataInterfaces()
170+
);
171+
}
150172
}

app/code/Magento/Theme/Block/Html/Pager.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,15 @@ public function getPagerUrl($params = [])
446446
$urlParams['_fragment'] = $this->getFragment();
447447
$urlParams['_query'] = $params;
448448

449-
return $this->getUrl('*/*/*', $urlParams);
449+
return $this->getUrl($this->getPath(), $urlParams);
450+
}
451+
452+
/**
453+
* @return string
454+
*/
455+
protected function getPath()
456+
{
457+
return $this->_getData('path') ?: '*/*/*';
450458
}
451459

452460
/**

app/code/Magento/Webapi/Model/Soap/Wsdl/Generator.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ class Generator
5050
protected $storeManager;
5151

5252
/**
53-
* @var array
53+
* @var \Magento\Framework\Webapi\CustomAttributeTypeLocatorInterface
5454
*/
55-
protected $customAttributeMapArray = null;
55+
protected $customAttributeTypeLocator = null;
5656

5757
/**
5858
* Initialize dependencies.
@@ -62,22 +62,22 @@ class Generator
6262
* @param \Magento\Framework\App\Cache\Type\Webapi $cache
6363
* @param \Magento\Framework\Reflection\TypeProcessor $typeProcessor
6464
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
65-
* @param \Magento\Framework\Object $customAttributeMap
65+
* @param \Magento\Framework\Webapi\CustomAttributeTypeLocatorInterface $customAttributeTypeLocator
6666
*/
6767
public function __construct(
6868
\Magento\Webapi\Model\Soap\Config $apiConfig,
6969
WsdlFactory $wsdlFactory,
7070
\Magento\Framework\App\Cache\Type\Webapi $cache,
7171
\Magento\Framework\Reflection\TypeProcessor $typeProcessor,
7272
\Magento\Store\Model\StoreManagerInterface $storeManager,
73-
\Magento\Framework\Object $customAttributeMap
73+
\Magento\Framework\Webapi\CustomAttributeTypeLocatorInterface $customAttributeTypeLocator
7474
) {
7575
$this->_apiConfig = $apiConfig;
7676
$this->_wsdlFactory = $wsdlFactory;
7777
$this->_cache = $cache;
7878
$this->_typeProcessor = $typeProcessor;
7979
$this->storeManager = $storeManager;
80-
$this->customAttributeMapArray = array_values($customAttributeMap->getData());
80+
$this->customAttributeTypeLocator = $customAttributeTypeLocator;
8181
}
8282

8383
/**
@@ -178,7 +178,7 @@ protected function _generate($requestedServices, $endPointUrl)
178178
*/
179179
protected function addCustomAttributeTypes($wsdl)
180180
{
181-
foreach ($this->customAttributeMapArray as $customAttributeClass) {
181+
foreach ($this->customAttributeTypeLocator->getAllServiceDataInterfaces() as $customAttributeClass) {
182182
$typeName = $this->_typeProcessor->register($customAttributeClass);
183183
$wsdl->addComplexType($typeName);
184184
}

app/code/Magento/Webapi/Test/Unit/Model/Soap/Wsdl/GeneratorTest.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ class GeneratorTest extends \PHPUnit_Framework_TestCase
1212
/** @var \Magento\Webapi\Model\Soap\Wsdl\Generator */
1313
protected $_wsdlGenerator;
1414

15-
/** @var \Magento\Framework\Object */
16-
protected $customAttributeMap;
15+
/**
16+
* @var \Magento\Framework\Webapi\CustomAttributeTypeLocatorInterface|\PHPUnit_Framework_MockObject_MockObject
17+
*/
18+
protected $customAttributeTypeLocator = null;
1719

1820
/** @var \Magento\Webapi\Model\Soap\Config|\PHPUnit_Framework_MockObject_MockObject */
1921
protected $_soapConfigMock;
@@ -93,7 +95,9 @@ protected function setUp()
9395

9496
$objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
9597

96-
$this->customAttributeMap = $objectManager->getObject('Magento\Framework\Object');
98+
$this->customAttributeTypeLocator = $objectManager
99+
->getObject('Magento\Eav\Model\EavCustomAttributeTypeLocator');
100+
97101
$this->_wsdlGenerator = $objectManager->getObject(
98102
'Magento\Webapi\Model\Soap\Wsdl\Generator',
99103
[
@@ -102,7 +106,7 @@ protected function setUp()
102106
'cache' => $this->_cacheMock,
103107
'typeProcessor' => $this->_typeProcessor,
104108
'storeManagerMock' => $this->storeManagerMock,
105-
'customAttributeMap' => $this->customAttributeMap
109+
'customAttributeTypeLocator' => $this->customAttributeTypeLocator
106110
]
107111
);
108112

@@ -196,7 +200,7 @@ public function testHandleWithException()
196200
$this->_cacheMock,
197201
$this->_typeProcessor,
198202
$this->storeManagerMock,
199-
$this->customAttributeMap
203+
$this->customAttributeTypeLocator
200204
]
201205
)->getMock();
202206

0 commit comments

Comments
 (0)