Skip to content

Commit 439df24

Browse files
author
Valeriy Nayda
committed
GraphQL-118: [Mutations] Cart Operations > Create Empty Cart
-- Slight fixes
1 parent 3176de0 commit 439df24

File tree

4 files changed

+9
-15
lines changed

4 files changed

+9
-15
lines changed

app/code/Magento/Quote/Model/MaskedQuoteIdToQuoteId.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function __construct(
4343
}
4444

4545
/**
46-
* {@inheritDoc}
46+
* @inheritDoc
4747
*/
4848
public function execute(string $maskedQuoteId): int
4949
{
@@ -52,6 +52,6 @@ public function execute(string $maskedQuoteId): int
5252

5353
$cart = $this->cartRepository->get($quoteIdMask->getQuoteId());
5454

55-
return (int) $cart->getId();
55+
return (int)$cart->getId();
5656
}
5757
}

app/code/Magento/Quote/Model/QuoteIdToMaskedQuoteId.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function __construct(
3434
}
3535

3636
/**
37-
* {@inheritDoc}
37+
* @inheritDoc
3838
*/
3939
public function execute(int $quoteId): string
4040
{

app/code/Magento/QuoteGraphQl/Model/Resolver/Cart/CreateEmptyCart.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
use Magento\Quote\Model\QuoteIdToMaskedQuoteIdInterface;
1919

2020
/**
21-
* {@inheritdoc}
21+
* @inheritdoc
2222
*/
2323
class CreateEmptyCart implements ResolverInterface
2424
{
@@ -69,23 +69,21 @@ public function __construct(
6969
}
7070

7171
/**
72-
* {@inheritDoc}
72+
* @inheritDoc
7373
*/
7474
public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null) : Value
7575
{
7676
$customerId = $this->userContext->getUserId();
7777

78-
if ($customerId) {
78+
if (null !== $customerId) {
7979
$quoteId = $this->cartManagement->createEmptyCartForCustomer($customerId);
8080
$maskedQuoteId = $this->quoteIdToMaskedId->execute($quoteId);
8181
} else {
8282
$maskedQuoteId = $this->guestCartManagement->createEmptyCart();
8383
}
8484

85-
$result = function () use ($maskedQuoteId) {
85+
return $this->valueFactory->create(function () use ($maskedQuoteId) {
8686
return $maskedQuoteId;
87-
};
88-
89-
return $this->valueFactory->create($result);
87+
});
9088
}
9189
}

app/code/Magento/QuoteGraphQl/etc/module.xml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,5 @@
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
9-
<module name="Magento_QuoteGraphQl">
10-
<sequence>
11-
<module name="Magento_GraphQl"/>
12-
</sequence>
13-
</module>
9+
<module name="Magento_QuoteGraphQl"/>
1410
</config>

0 commit comments

Comments
 (0)