Skip to content
This repository was archived by the owner on Dec 19, 2019. It is now read-only.

Commit 484c65c

Browse files
author
Valeriy Nayda
committed
GraphQL-141: [Mutations] Cart Operations > Add simple product to Cart
-- fix static builds
1 parent ada51dc commit 484c65c

File tree

4 files changed

+13
-2
lines changed

4 files changed

+13
-2
lines changed

app/code/Magento/CatalogGraphQl/Model/Product/Option/DateType.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,18 @@
1313

1414
/**
1515
* Catalog product option date validator
16+
*
1617
* {@inheritdoc}
1718
*/
1819
class DateType extends ProductDateOptionType
1920
{
2021
/**
2122
* Make valid string as a value of date option type for GraphQl queries
23+
*
2224
* {@inheritdoc}
25+
*
26+
* @param array $values All product option values, i.e. array (option_id => mixed, option_id => mixed...)
27+
* @return $this
2328
*/
2429
public function validateUserValue($values)
2530
{

app/code/Magento/QuoteGraphQl/Model/Cart/AddProductsToCart.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ public function execute(string $cartHash, array $cartItems): Quote
8787
}
8888

8989
/**
90+
* Get cart
91+
*
9092
* @param string $cartHash
9193
* @return Quote
9294
* @throws GraphQlNoSuchEntityException

app/code/Magento/QuoteGraphQl/Model/Cart/AddSimpleProductToCart.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ private function extractSku(array $cartItemData): string
9292
{
9393
$sku = $this->arrayManager->get('data/sku', $cartItemData);
9494
if (!isset($sku)) {
95-
throw new GraphQlInputException( __('Missing key "sku" in cart item data'));
95+
throw new GraphQlInputException(__('Missing key "sku" in cart item data'));
9696
}
9797
return (string)$sku;
9898
}
@@ -108,7 +108,7 @@ private function extractQty(array $cartItemData): float
108108
{
109109
$qty = $this->arrayManager->get('data/qty', $cartItemData);
110110
if (!isset($qty)) {
111-
throw new GraphQlInputException( __('Missing key "qty" in cart item data'));
111+
throw new GraphQlInputException(__('Missing key "qty" in cart item data'));
112112
}
113113
return (float)$qty;
114114
}

app/code/Magento/QuoteGraphQl/Model/Resolver/CartItemTypeResolver.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
namespace Magento\QuoteGraphQl\Model\Resolver;
99

1010
use Magento\Framework\Exception\LocalizedException;
11+
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
1112
use Magento\Framework\GraphQl\Query\Resolver\TypeResolverInterface;
1213

1314
/**
@@ -31,6 +32,9 @@ public function __construct(array $supportedTypes = [])
3132
/**
3233
* {@inheritdoc}
3334
*
35+
* @param array $data
36+
* @return string
37+
* @throws GraphQlInputException
3438
* @throws LocalizedException
3539
*/
3640
public function resolveType(array $data) : string

0 commit comments

Comments
 (0)