Skip to content

Commit 787564d

Browse files
author
Yu Tang
committed
MAGETWO-32409: GiftCard Integration API
- Change data_objects.xml to service_data_attributes.xml
1 parent cdf59df commit 787564d

File tree

6 files changed

+21
-25
lines changed

6 files changed

+21
-25
lines changed

app/code/Magento/CatalogInventory/etc/data_object.xml

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

app/code/Magento/CatalogInventory/etc/service_data_attributes.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,10 @@
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Api/etc/service_data_attributes.xsd">
99
<extension_attributes for="Magento\Catalog\Api\Data\ProductInterface">
10-
<!--
11-
Once this is merged with the branch with the CatalogInventory integration, need to make sure the permission
12-
below is actually used.
1310
<attribute code="stock_item" type="Magento\CatalogInventory\Api\Data\StockItemInterface">
1411
<resources>
1512
<resource ref="Magento_CatalogInventory::cataloginventory"/>
1613
</resources>
1714
</attribute>
18-
-->
1915
</extension_attributes>
2016
</config>

app/code/Magento/ConfigurableProduct/etc/data_object.xml renamed to app/code/Magento/ConfigurableProduct/etc/service_data_attributes.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
* See COPYING.txt for license details.
66
*/
77
-->
8-
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Api/etc/data_object.xsd">
9-
<custom_attributes for="Magento\Catalog\Api\Data\ProductInterface">
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Api/etc/service_data_attributes.xsd">
9+
<extension_attributes for="Magento\Catalog\Api\Data\ProductInterface">
1010
<attribute code="configurable_product_options" type="Magento\ConfigurableProduct\Api\Data\OptionInterface[]" />
1111
<attribute code="configurable_product_links" type="int[]" />
12-
</custom_attributes>
12+
</extension_attributes>
1313
</config>

app/code/Magento/Downloadable/etc/data_object.xml renamed to app/code/Magento/Downloadable/etc/service_data_attributes.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
* See COPYING.txt for license details.
66
*/
77
-->
8-
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Api/etc/data_object.xsd">
9-
<custom_attributes for="Magento\Catalog\Api\Data\ProductInterface">
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Api/etc/service_data_attributes.xsd">
9+
<extension_attributes for="Magento\Catalog\Api\Data\ProductInterface">
1010
<attribute code="downloadable_product_links" type="Magento\Downloadable\Api\Data\LinkInterface[]" />
1111
<attribute code="downloadable_product_samples" type="Magento\Downloadable\Api\Data\SampleInterface[]" />
12-
</custom_attributes>
12+
</extension_attributes>
1313
</config>

lib/internal/Magento/Framework/Reflection/AttributeTypeResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function resolveObjectType($attributeCode, $value, $context)
4444
$config = isset($data[$context]) ? $data[$context] : [];
4545
$output = get_class($value);
4646
if (isset($config[$attributeCode])) {
47-
$type = $config[$attributeCode];
47+
$type = $config[$attributeCode]['type'];
4848
$output = $this->typeProcessor->getArrayItemType($type);
4949
if (!(class_exists($output) || interface_exists($output))) {
5050
throw new \LogicException(

lib/internal/Magento/Framework/Reflection/Test/Unit/AttributeTypeResolverTest.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,13 @@ public function testResolveObjectTypeWithConfiguredAttribute()
6262
$code = 'some_code';
6363
$value = new \stdClass();
6464
$context = '\Some\Class';
65-
$config = ['Some\Class' => ['some_code' => '\Magento\Framework\Object']];
65+
$config = [
66+
'Some\Class' => [
67+
'some_code' => [
68+
'type' => '\Magento\Framework\Object',
69+
],
70+
]
71+
];
6672

6773
$this->typeProcessor->expects($this->once())
6874
->method('getArrayItemType')
@@ -82,7 +88,13 @@ public function testResolveObjectTypeWithConfiguredAttributeAndNonExistedClass()
8288
$code = 'some_code';
8389
$value = new \stdClass();
8490
$context = '\Some\Class';
85-
$config = ['Some\Class' => ['some_code' => '\Some\Class']];
91+
$config = [
92+
'Some\Class' => [
93+
'some_code' => [
94+
'type' => '\Some\Class',
95+
]
96+
]
97+
];
8698

8799
$this->typeProcessor->expects($this->once())
88100
->method('getArrayItemType')

0 commit comments

Comments
 (0)