Skip to content

Commit 0977e94

Browse files
committed
[Wishlist] Remove name from WishlistOutput #920
1 parent b52fe3e commit 0977e94

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

app/code/Magento/WishlistGraphQl/Model/Resolver/CustomerWishlistsResolver.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,16 @@ public function resolve(
4141
array $value = null,
4242
array $args = null
4343
) {
44-
$customerId = $context->getUserId();
45-
4644
/* Guest checking */
47-
if (!$customerId && 0 === $customerId) {
45+
if (false === $context->getExtensionAttributes()->getIsCustomer()) {
4846
throw new GraphQlAuthorizationException(__('The current user cannot perform operations on wishlist'));
4947
}
50-
$collection = $this->_wishlistCollectionFactory->create()->filterByCustomerId($customerId);
51-
$wishlists = $collection->getItems();
48+
$collection = $this->_wishlistCollectionFactory->create()->filterByCustomerId($context->getUserId());
5249
$wishlistsData = [];
53-
if (0 === count($wishlists)) {
50+
if (0 === $collection->getSize()) {
5451
return $wishlistsData;
5552
}
53+
$wishlists = $collection->getItems();
5654

5755
foreach ($wishlists as $wishlist) {
5856
$wishlistsData [] = [

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ type Customer {
1010
}
1111

1212
type WishlistOutput @doc(description: "Deprecated: 'Wishlist' type should be used instead") {
13-
items: [WishlistItem] @deprecated(reason: "Use field `items` from type `Wishlist` instead") @resolver(class: "\\Magento\\WishlistGraphQl\\Model\\Resolver\\WishlistItemsResolver") @doc(description: "An array of items in the customer's wish list"),
13+
items: [WishlistItem] @deprecated(reason: "Use field `items` from type `Wishlist` instead") @resolver(class: "\\Magento\\WishlistGraphQl\\Model\\Resolver\\WishlistItemsResolver") @doc(description: "An array of items in the customer's wish list"),
1414
items_count: Int @deprecated(reason: "Use field `items_count` from type `Wishlist` instead") @doc(description: "The number of items in the wish list"),
1515
name: String @deprecated(reason: "This field is related to Commerce functionality and is always null in Open source edition") @doc(description: "When multiple wish lists are enabled, the name the customer assigns to the wishlist"),
1616
sharing_code: String @deprecated(reason: "Use field `sharing_code` from type `Wishlist` instead") @doc(description: "An encrypted code that Magento uses to link to the wish list"),

0 commit comments

Comments
 (0)