Skip to content

Commit de52a1f

Browse files
committed
Merge remote-tracking branch 'origin/2.3.1-release' into MC-10964
2 parents 5d285b3 + 74962be commit de52a1f

File tree

12 files changed

+14
-309
lines changed

12 files changed

+14
-309
lines changed

app/code/Magento/Catalog/Model/CategoryList.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,10 @@ public function getList(SearchCriteriaInterface $searchCriteria)
7676
$this->extensionAttributesJoinProcessor->process($collection);
7777

7878
$this->collectionProcessor->process($searchCriteria, $collection);
79-
$collection->load();
8079

8180
$items = [];
82-
foreach ($collection->getItems() as $category) {
83-
$items[] = $this->categoryRepository->get($category->getId());
81+
foreach ($collection->getAllIds() as $id) {
82+
$items[] = $this->categoryRepository->get($id);
8483
}
8584

8685
/** @var CategorySearchResultsInterface $searchResult */

app/code/Magento/Catalog/Test/Unit/Model/CategoryListTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function testGetList()
9393

9494
$collection = $this->getMockBuilder(Collection::class)->disableOriginalConstructor()->getMock();
9595
$collection->expects($this->once())->method('getSize')->willReturn($totalCount);
96-
$collection->expects($this->once())->method('getItems')->willReturn([$categoryFirst, $categorySecond]);
96+
$collection->expects($this->once())->method('getAllIds')->willReturn([$categoryIdFirst, $categoryIdSecond]);
9797

9898
$this->collectionProcessorMock->expects($this->once())
9999
->method('process')

app/code/Magento/CatalogGraphQl/Model/Resolver/Products.php

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
namespace Magento\CatalogGraphQl\Model\Resolver;
99

10-
use Magento\Framework\Exception\InputException;
1110
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
1211
use Magento\CatalogGraphQl\Model\Resolver\Products\Query\Filter;
1312
use Magento\CatalogGraphQl\Model\Resolver\Products\Query\Search;
@@ -17,7 +16,6 @@
1716
use Magento\Framework\GraphQl\Query\Resolver\Argument\SearchCriteria\SearchFilter;
1817
use Magento\Framework\GraphQl\Query\ResolverInterface;
1918
use Magento\Catalog\Model\Layer\Resolver;
20-
use Magento\Framework\Api\Search\SearchCriteriaInterface;
2119

2220
/**
2321
* Products field resolver, used for GraphQL request processing.
@@ -82,10 +80,10 @@ public function resolve(
8280
} elseif (isset($args['search'])) {
8381
$layerType = Resolver::CATALOG_LAYER_SEARCH;
8482
$this->searchFilter->add($args['search'], $searchCriteria);
85-
$searchResult = $this->getSearchResult($this->searchQuery, $searchCriteria, $info);
83+
$searchResult = $this->searchQuery->getResult($searchCriteria, $info);
8684
} else {
8785
$layerType = Resolver::CATALOG_LAYER_CATEGORY;
88-
$searchResult = $this->getSearchResult($this->filterQuery, $searchCriteria, $info);
86+
$searchResult = $this->filterQuery->getResult($searchCriteria, $info);
8987
}
9088
//possible division by 0
9189
if ($searchCriteria->getPageSize()) {
@@ -117,25 +115,4 @@ public function resolve(
117115

118116
return $data;
119117
}
120-
121-
/**
122-
* Get search result.
123-
*
124-
* @param Filter|Search $query
125-
* @param SearchCriteriaInterface $searchCriteria
126-
* @param ResolveInfo $info
127-
*
128-
* @return \Magento\CatalogGraphQl\Model\Resolver\Products\SearchResult
129-
* @throws GraphQlInputException
130-
*/
131-
private function getSearchResult($query, SearchCriteriaInterface $searchCriteria, ResolveInfo $info)
132-
{
133-
try {
134-
$searchResult = $query->getResult($searchCriteria, $info);
135-
} catch (InputException $e) {
136-
throw new GraphQlInputException(__($e->getMessage()));
137-
}
138-
139-
return $searchResult;
140-
}
141118
}
Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
# Copyright © Magento, Inc. All rights reserved.
22
# See COPYING.txt for license details.
3-
type Mutation {
4-
addConfigurableProductsToCart(input: AddConfigurableProductsToCartInput): AddConfigurableProductsToCartOutput @resolver(class: "Magento\\QuoteGraphQl\\Model\\Resolver\\AddSimpleProductsToCart")
5-
}
63

74
type ConfigurableProduct implements ProductInterface, PhysicalProductInterface, CustomizableProductInterface @doc(description: "ConfigurableProduct defines basic features of a configurable product and its simple product variants") {
85
variants: [ConfigurableVariant] @doc(description: "An array of variants of products") @resolver(class: "Magento\\ConfigurableProductGraphQl\\Model\\Resolver\\ConfigurableVariant")
@@ -38,30 +35,3 @@ type ConfigurableProductOptionsValues @doc(description: "ConfigurableProductOpti
3835
store_label: String @doc(description: "The label of the product on the current store")
3936
use_default_value: Boolean @doc(description: "Indicates whether to use the default_label")
4037
}
41-
42-
input AddConfigurableProductsToCartInput {
43-
cart_id: String!
44-
cartItems: [ConfigurableProductCartItemInput!]!
45-
}
46-
47-
type AddConfigurableProductsToCartOutput {
48-
cart: Cart!
49-
}
50-
51-
input ConfigurableProductCartItemInput {
52-
data: CartItemDetailsInput!
53-
variant_sku: String!
54-
customizable_options:[CustomizableOptionInput!]
55-
}
56-
57-
type ConfigurableCartItem implements CartItemInterface {
58-
customizable_options: [SelectedCustomizableOption]!
59-
configurable_options: [SelectedConfigurableOption!]!
60-
}
61-
62-
type SelectedConfigurableOption {
63-
id: Int!
64-
option_label: String!
65-
value_id: Int!
66-
value_label: String!
67-
}
Lines changed: 1 addition & 227 deletions
Original file line numberDiff line numberDiff line change
@@ -1,232 +1,6 @@
11
# Copyright © Magento, Inc. All rights reserved.
22
# See COPYING.txt for license details.
33

4-
type Query {
5-
cart(cart_id: String!): Cart @resolver (class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\Cart") @doc(description:"Returns information about shopping cart")
6-
}
7-
84
type Mutation {
9-
createEmptyCart: String @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\CreateEmptyCart") @doc(description:"Creates an empty shopping cart for a guest or logged in user")
10-
applyCouponToCart(input: ApplyCouponToCartInput): ApplyCouponToCartOutput @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\Coupon\\ApplyCouponToCart")
11-
removeCouponFromCart(input: RemoveCouponFromCartInput): RemoveCouponFromCartOutput @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\Coupon\\RemoveCouponFromCart")
12-
setShippingAddressesOnCart(input: SetShippingAddressesOnCartInput): SetShippingAddressesOnCartOutput @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\SetShippingAddressesOnCart")
13-
applyCouponToCart(input: ApplyCouponToCartInput): ApplyCouponToCartOutput @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\ApplyCouponToCart")
14-
removeCouponFromCart(input: RemoveCouponFromCartInput): RemoveCouponFromCartOutput @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\RemoveCouponFromCart")
15-
setBillingAddressOnCart(input: SetBillingAddressOnCartInput): SetBillingAddressOnCartOutput @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\SetBillingAddressOnCart")
16-
setShippingMethodsOnCart(input: SetShippingMethodsOnCartInput): SetShippingMethodsOnCartOutput @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\SetShippingMethodsOnCart")
17-
addSimpleProductsToCart(input: AddSimpleProductsToCartInput): AddSimpleProductsToCartOutput @resolver(class: "Magento\\QuoteGraphQl\\Model\\Resolver\\AddSimpleProductsToCart")
18-
}
19-
20-
input SetShippingAddressesOnCartInput {
21-
cart_id: String!
22-
shipping_addresses: [ShippingAddressInput!]!
23-
}
24-
25-
input ShippingAddressInput {
26-
customer_address_id: Int # Can be provided in one-page checkout and is required for multi-shipping checkout
27-
address: CartAddressInput
28-
cart_items: [CartItemQuantityInput!]
29-
}
30-
31-
input CartItemQuantityInput {
32-
cart_item_id: Int!
33-
quantity: Float!
34-
}
35-
36-
input SetBillingAddressOnCartInput {
37-
cart_id: String!
38-
billing_address: BillingAddressInput!
39-
}
40-
41-
input BillingAddressInput {
42-
customer_address_id: Int
43-
address: CartAddressInput
44-
use_for_shipping: Boolean
45-
}
46-
47-
input CartAddressInput {
48-
firstname: String!
49-
lastname: String!
50-
company: String
51-
street: [String!]!
52-
city: String!
53-
region: String
54-
postcode: String
55-
country_code: String!
56-
telephone: String!
57-
save_in_address_book: Boolean!
58-
}
59-
60-
input SetShippingMethodsOnCartInput {
61-
cart_id: String!
62-
shipping_methods: [ShippingMethodForAddressInput!]!
63-
}
64-
65-
input ShippingMethodForAddressInput {
66-
cart_address_id: Int!
67-
carrier_code: String!
68-
method_code: String!
69-
}
70-
71-
type SetBillingAddressOnCartOutput {
72-
cart: Cart!
73-
}
74-
75-
type SetShippingAddressesOnCartOutput {
76-
cart: Cart!
77-
}
78-
79-
type SetShippingMethodsOnCartOutput {
80-
cart: Cart!
81-
}
82-
83-
# If no address is provided, the system get address assigned to a quote
84-
# If there's no address at all - the system returns all shipping methods
85-
input AvailableShippingMethodsOnCartInput {
86-
cart_id: String!
87-
customer_address_id: Int
88-
address: CartAddressInput
89-
}
90-
91-
input ApplyCouponToCartInput {
92-
cart_id: String!
93-
coupon_code: String!
94-
}
95-
96-
type ApplyCouponToCartOutput {
97-
cart: Cart!
98-
}
99-
100-
type Cart {
101-
cart_id: String
102-
items: [CartItemInterface]
103-
applied_coupon: AppliedCoupon
104-
shipping_addresses: [CartAddress]! @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\ShippingAddresses")
105-
billing_address: CartAddress! @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\BillingAddress")
106-
}
107-
108-
type CartAddress {
109-
firstname: String
110-
lastname: String
111-
company: String
112-
street: [String]
113-
city: String
114-
region: CartAddressRegion
115-
postcode: String
116-
country: CartAddressCountry
117-
telephone: String
118-
address_type: AdressTypeEnum
119-
items_weight: Float
120-
customer_notes: String
121-
cart_items: [CartItemQuantity]
122-
}
123-
124-
type CartItemQuantity {
125-
cart_item_id: String!
126-
quantity: Float!
127-
}
128-
129-
type CartAddressRegion {
130-
code: String
131-
label: String
132-
}
133-
134-
type CartAddressCountry {
135-
code: String
136-
label: String
137-
}
138-
139-
type SelectedShippingMethod {
140-
amount: Float!
141-
}
142-
143-
type AvailableShippingMethod {
144-
carrier_code: String!
145-
carrier_title: String!
146-
method_code: String!
147-
method_title: String!
148-
error_message: String
149-
amount: Float!
150-
base_amount: Float!
151-
price_excl_tax: Float!
152-
price_incl_tax: Float!
153-
}
154-
155-
enum AdressTypeEnum {
156-
SHIPPING
157-
BILLING
158-
}
159-
160-
type AppliedCoupon {
161-
code: String!
162-
}
163-
164-
input RemoveCouponFromCartInput {
165-
cart_id: String!
166-
}
167-
168-
type RemoveCouponFromCartOutput {
169-
cart: Cart
170-
}
171-
172-
input AddSimpleProductsToCartInput {
173-
cart_id: String!
174-
cartItems: [SimpleProductCartItemInput!]!
175-
}
176-
177-
input SimpleProductCartItemInput {
178-
data: CartItemInput!
179-
customizable_options:[CustomizableOptionInput!]
180-
}
181-
182-
input CustomizableOptionInput {
183-
id: Int!
184-
value: String!
185-
}
186-
187-
type AddSimpleProductsToCartOutput {
188-
cart: Cart!
189-
}
190-
191-
type SimpleCartItem implements CartItemInterface @doc(description: "Simple Cart Item") {
192-
customizable_options: [SelectedCustomizableOption] @resolver(class: "Magento\\QuoteGraphQl\\Model\\Resolver\\CustomizableOptions")
193-
}
194-
195-
input CartItemInput {
196-
sku: String!
197-
qty: Float!
198-
}
199-
200-
interface CartItemInterface @typeResolver(class: "Magento\\QuoteGraphQl\\Model\\Resolver\\CartItemTypeResolver") {
201-
id: String!
202-
qty: Float!
203-
product: ProductInterface!
204-
}
205-
206-
type SelectedCustomizableOption {
207-
id: Int!
208-
label: String!
209-
type: String!
210-
is_required: Int!
211-
values: [SelectedCustomizableOptionValue!]!
212-
sort_order: Int!
213-
}
214-
215-
type SelectedCustomizableOptionValue {
216-
id: Int!
217-
label: String!
218-
value: String!
219-
price: CartItemSelectedOptionValuePrice!
220-
sort_order: Int!
221-
}
222-
223-
type CartItemSelectedOptionValuePrice {
224-
value: Float!
225-
units: String!
226-
type: PriceTypeEnum!
227-
}
228-
229-
input CartItemDetailsInput {
230-
sku: String!
231-
qty: Float!
5+
createEmptyCart: String @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\CreateEmptyCart") @doc(description:"Creates empty shopping cart for guest or logged in user")
2326
}

dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/AddSimpleProductToCartTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class AddSimpleProductToCartTest extends GraphQlAbstract
3535
*/
3636
protected function setUp()
3737
{
38+
$this->markTestIncomplete('https://github.com/magento/graphql-ce/issues/434');
3839
$objectManager = Bootstrap::getObjectManager();
3940
$this->quoteResource = $objectManager->get(QuoteResource::class);
4041
$this->quote = $objectManager->create(Quote::class);
@@ -75,7 +76,9 @@ public function testAddProductIfQuantityIsNotAvailable()
7576
}
7677
) {
7778
cart {
78-
cart_id
79+
items {
80+
qty
81+
}
7982
}
8083
}
8184
}

dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/CouponTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class CouponTest extends GraphQlAbstract
3535

3636
protected function setUp()
3737
{
38+
$this->markTestIncomplete('https://github.com/magento/graphql-ce/issues/434');
3839
$objectManager = Bootstrap::getObjectManager();
3940
$this->quoteResource = $objectManager->create(QuoteResource::class);
4041
$this->quote = $objectManager->create(Quote::class);

dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/GetCartTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ class GetCartTest extends GraphQlAbstract
4444
*/
4545
protected function setUp()
4646
{
47+
$this->markTestIncomplete('https://github.com/magento/graphql-ce/issues/434');
4748
$objectManager = Bootstrap::getObjectManager();
4849
$this->quoteResource = $objectManager->create(QuoteResource::class);
4950
$this->quote = $objectManager->create(Quote::class);

dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/SetBillingAddressOnCartTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ class SetBillingAddressOnCartTest extends GraphQlAbstract
4444

4545
protected function setUp()
4646
{
47+
$this->markTestIncomplete('https://github.com/magento/graphql-ce/issues/434');
4748
$objectManager = Bootstrap::getObjectManager();
4849
$this->quoteResource = $objectManager->get(QuoteResource::class);
4950
$this->quoteFactory = $objectManager->get(QuoteFactory::class);

0 commit comments

Comments
 (0)