Skip to content

Commit 1f06dea

Browse files
author
Vitaliy Boyko
committed
graphQl-786: deprecated qty
1 parent 2b85a2c commit 1f06dea

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

app/code/Magento/BundleGraphQl/Model/Resolver/Links/Collection.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ private function fetch() : array
117117
'price' => $link->getSelectionPriceValue(),
118118
'position' => $link->getPosition(),
119119
'id' => $link->getSelectionId(),
120+
'qty' => (int)$link->getSelectionQty(),
120121
'quantity' => (int)$link->getSelectionQty(),
121122
'is_default' => (bool)$link->getIsDefault(),
122123
'price_type' => $this->enumLookup->getEnumValueFromField(

app/code/Magento/BundleGraphQl/etc/schema.graphqls

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ type BundleItem @doc(description: "BundleItem defines an individual item in a bu
1414
type BundleItemOption @doc(description: "BundleItemOption defines characteristics and options for a specific bundle item.") {
1515
id: Int @doc(description: "The ID assigned to the bundled item option.")
1616
label: String @doc(description: "The text that identifies the bundled item option.") @resolver(class: "Magento\\BundleGraphQl\\Model\\Resolver\\Options\\Label")
17+
qty: Float @deprecated(reason: "The `qty` is deprecated. Use `quantity` instead.") @doc(description: "Indicates the quantity of this specific bundle item.")
1718
quantity: Float @doc(description: "Indicates the quantity of this specific bundle item.")
1819
position: Int @doc(description: "When a bundle item contains multiple options, the relative position of this option compared to the other options.")
1920
is_default: Boolean @doc(description: "Indicates whether this option is the default option.")

dev/tests/api-functional/testsuite/Magento/GraphQl/Bundle/BundleProductViewTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,8 +428,9 @@ public function testNonExistentFieldQtyExceptionOnBundleProduct()
428428
QUERY;
429429

430430
$this->expectException(\Exception::class);
431-
$this->expectExceptionMessage('GraphQL response contains errors: Cannot'. ' ' .
432-
'query field "qty" on type "ProductInterface".');
431+
$this->expectExceptionMessage(
432+
'GraphQL response contains errors: Cannot query field "qty" on type "ProductInterface".'
433+
);
433434
$this->graphQlQuery($query);
434435
}
435436
}

0 commit comments

Comments
 (0)