Skip to content
Snippets Groups Projects
Commit 787564d0 authored by Yu Tang's avatar Yu Tang
Browse files

MAGETWO-32409: GiftCard Integration API

    - Change data_objects.xml to service_data_attributes.xml
parent cdf59dfa
No related merge requests found
<?xml version="1.0"?>
<!--
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Api/etc/data_object.xsd">
<custom_attributes for="Magento\Catalog\Api\Data\ProductInterface">
<attribute code="stock_item" type="Magento\CatalogInventory\Api\Data\StockItemInterface" />
</custom_attributes>
</config>
......@@ -7,14 +7,10 @@
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Api/etc/service_data_attributes.xsd">
<extension_attributes for="Magento\Catalog\Api\Data\ProductInterface">
<!--
Once this is merged with the branch with the CatalogInventory integration, need to make sure the permission
below is actually used.
<attribute code="stock_item" type="Magento\CatalogInventory\Api\Data\StockItemInterface">
<resources>
<resource ref="Magento_CatalogInventory::cataloginventory"/>
</resources>
</attribute>
-->
</extension_attributes>
</config>
......@@ -5,9 +5,9 @@
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Api/etc/data_object.xsd">
<custom_attributes for="Magento\Catalog\Api\Data\ProductInterface">
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Api/etc/service_data_attributes.xsd">
<extension_attributes for="Magento\Catalog\Api\Data\ProductInterface">
<attribute code="configurable_product_options" type="Magento\ConfigurableProduct\Api\Data\OptionInterface[]" />
<attribute code="configurable_product_links" type="int[]" />
</custom_attributes>
</extension_attributes>
</config>
......@@ -5,9 +5,9 @@
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Api/etc/data_object.xsd">
<custom_attributes for="Magento\Catalog\Api\Data\ProductInterface">
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Api/etc/service_data_attributes.xsd">
<extension_attributes for="Magento\Catalog\Api\Data\ProductInterface">
<attribute code="downloadable_product_links" type="Magento\Downloadable\Api\Data\LinkInterface[]" />
<attribute code="downloadable_product_samples" type="Magento\Downloadable\Api\Data\SampleInterface[]" />
</custom_attributes>
</extension_attributes>
</config>
......@@ -44,7 +44,7 @@ class AttributeTypeResolver implements AttributeTypeResolverInterface
$config = isset($data[$context]) ? $data[$context] : [];
$output = get_class($value);
if (isset($config[$attributeCode])) {
$type = $config[$attributeCode];
$type = $config[$attributeCode]['type'];
$output = $this->typeProcessor->getArrayItemType($type);
if (!(class_exists($output) || interface_exists($output))) {
throw new \LogicException(
......
......@@ -62,7 +62,13 @@ class AttributeTypeResolverTest extends \PHPUnit_Framework_TestCase
$code = 'some_code';
$value = new \stdClass();
$context = '\Some\Class';
$config = ['Some\Class' => ['some_code' => '\Magento\Framework\Object']];
$config = [
'Some\Class' => [
'some_code' => [
'type' => '\Magento\Framework\Object',
],
]
];
$this->typeProcessor->expects($this->once())
->method('getArrayItemType')
......@@ -82,7 +88,13 @@ class AttributeTypeResolverTest extends \PHPUnit_Framework_TestCase
$code = 'some_code';
$value = new \stdClass();
$context = '\Some\Class';
$config = ['Some\Class' => ['some_code' => '\Some\Class']];
$config = [
'Some\Class' => [
'some_code' => [
'type' => '\Some\Class',
]
]
];
$this->typeProcessor->expects($this->once())
->method('getArrayItemType')
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment