diff --git a/app/code/Magento/CatalogInventory/etc/data_object.xml b/app/code/Magento/CatalogInventory/etc/data_object.xml deleted file mode 100644 index 05dcea3df63c0758b74d199cd18694981cc0ee35..0000000000000000000000000000000000000000 --- a/app/code/Magento/CatalogInventory/etc/data_object.xml +++ /dev/null @@ -1,12 +0,0 @@ -<?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> diff --git a/app/code/Magento/CatalogInventory/etc/service_data_attributes.xml b/app/code/Magento/CatalogInventory/etc/service_data_attributes.xml index 577b4678c42e99ad5d250f34409c2c5e51654848..587b98b401a0981d8ca14b75242f0adac67312a2 100644 --- a/app/code/Magento/CatalogInventory/etc/service_data_attributes.xml +++ b/app/code/Magento/CatalogInventory/etc/service_data_attributes.xml @@ -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> diff --git a/app/code/Magento/ConfigurableProduct/etc/data_object.xml b/app/code/Magento/ConfigurableProduct/etc/service_data_attributes.xml similarity index 75% rename from app/code/Magento/ConfigurableProduct/etc/data_object.xml rename to app/code/Magento/ConfigurableProduct/etc/service_data_attributes.xml index f8572079b7b93ee8bb0ce1841ceaebe7b0dbf318..74edcdbf65a91e08cc384b50b416deff63e8780c 100644 --- a/app/code/Magento/ConfigurableProduct/etc/data_object.xml +++ b/app/code/Magento/ConfigurableProduct/etc/service_data_attributes.xml @@ -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> diff --git a/app/code/Magento/Downloadable/etc/data_object.xml b/app/code/Magento/Downloadable/etc/service_data_attributes.xml similarity index 76% rename from app/code/Magento/Downloadable/etc/data_object.xml rename to app/code/Magento/Downloadable/etc/service_data_attributes.xml index dd9f05c1a28bad87c4f9b089bc9b10ac2079cb40..80cc1cb0abf9ff457b97d12eddc9b3b6ee519784 100644 --- a/app/code/Magento/Downloadable/etc/data_object.xml +++ b/app/code/Magento/Downloadable/etc/service_data_attributes.xml @@ -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> diff --git a/lib/internal/Magento/Framework/Reflection/AttributeTypeResolver.php b/lib/internal/Magento/Framework/Reflection/AttributeTypeResolver.php index 8552cba5a5d2458014a60e259857fc5c01becf90..6824dca09e58c813d114dba3f3c720dad27a710d 100644 --- a/lib/internal/Magento/Framework/Reflection/AttributeTypeResolver.php +++ b/lib/internal/Magento/Framework/Reflection/AttributeTypeResolver.php @@ -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( diff --git a/lib/internal/Magento/Framework/Reflection/Test/Unit/AttributeTypeResolverTest.php b/lib/internal/Magento/Framework/Reflection/Test/Unit/AttributeTypeResolverTest.php index 8391d4643482d17da3c717dbbc732b7c43002b19..68902f3851380d368c88ca8e2357bada00a2de7d 100644 --- a/lib/internal/Magento/Framework/Reflection/Test/Unit/AttributeTypeResolverTest.php +++ b/lib/internal/Magento/Framework/Reflection/Test/Unit/AttributeTypeResolverTest.php @@ -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')