extension_attributes.xml 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <?xml version="1.0"?>
  2. <!--
  3. /**
  4. * Copyright © Magento, Inc. All rights reserved.
  5. * See COPYING.txt for license details.
  6. */
  7. -->
  8. <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  9. xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
  10. <extension_attributes for="Magento\Catalog\Api\Data\ProductInterface">
  11. <attribute code="test_stock_item" type="Magento\CatalogInventory\Api\Data\StockItemInterface">
  12. <resources>
  13. <resource ref="Magento_CatalogInventory::cataloginventory"/>
  14. </resources>
  15. <join reference_table="cataloginventory_stock_item"
  16. join_on_field="entity_id"
  17. reference_field="product_id"
  18. >
  19. <field>qty</field>
  20. <field>item_id</field>
  21. </join>
  22. </attribute>
  23. <attribute code="test_stock_item_qty" type="string">
  24. <resources>
  25. <resource ref="Magento_CatalogInventory::cataloginventory"/>
  26. </resources>
  27. <join reference_table="cataloginventory_stock_item"
  28. join_on_field="entity_id"
  29. reference_field="product_id"
  30. >
  31. <field>qty</field>
  32. </join>
  33. </attribute>
  34. </extension_attributes>
  35. <extension_attributes for="Magento\TestModuleExtensionAttributes\Api\Data\FakeCustomerInterface">
  36. <attribute code="test_group_code" type="string">
  37. <join reference_table="customer_group"
  38. join_on_field="group_id"
  39. reference_field="customer_group_id"
  40. >
  41. <field>customer_group_code</field>
  42. </join>
  43. </attribute>
  44. </extension_attributes>
  45. <extension_attributes for="Magento\Customer\Api\Data\CustomerInterface">
  46. <attribute code="test_group_code" type="string">
  47. <join reference_table="customer_group"
  48. join_on_field="group_id"
  49. reference_field="customer_group_id"
  50. >
  51. <field>customer_group_code</field>
  52. </join>
  53. </attribute>
  54. <attribute code="test_group" type="Magento\Customer\Api\Data\GroupInterface">
  55. <join reference_table="customer_group"
  56. join_on_field="group_id"
  57. reference_field="customer_group_id"
  58. >
  59. <field>tax_class_id</field>
  60. <field column="customer_group_code">code</field>
  61. </join>
  62. </attribute>
  63. </extension_attributes>
  64. <extension_attributes for="Magento\Customer\Api\Data\GroupInterface">
  65. <attribute code="test_dummy_attribute" type="string">
  66. <join reference_table="eav_attribute"
  67. reference_field="attribute_id"
  68. join_on_field="customer_group_id"
  69. >
  70. <field>attribute_code</field>
  71. </join>
  72. </attribute>
  73. <attribute code="test_complex_dummy_attribute" type="Magento\Catalog\Api\Data\ProductAttributeInterface">
  74. <join reference_table="admin_user"
  75. reference_field="user_id"
  76. join_on_field="customer_group_id"
  77. >
  78. <field column="username">attribute_code</field>
  79. <field column="firstname">frontend_label</field>
  80. </join>
  81. </attribute>
  82. </extension_attributes>
  83. <extension_attributes for="Magento\Sales\Api\Data\InvoiceInterface">
  84. <attribute code="test_dummy_attribute" type="string">
  85. <join reference_table="eav_attribute"
  86. reference_field="attribute_id"
  87. join_on_field="entity_id"
  88. >
  89. <field>attribute_code</field>
  90. </join>
  91. </attribute>
  92. </extension_attributes>
  93. </config>