From 883122105a47114ebcb8ce1a5ed5deefc330d207 Mon Sep 17 00:00:00 2001 From: Valerii Naida Date: Thu, 13 Jun 2019 18:03:18 -0500 Subject: [PATCH] magento/graphql-ce#741: Add extension point to set custom parameters to Query Context object --- .../CustomerGraphQl/Model/Resolver/IsSubscribed.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/CustomerGraphQl/Model/Resolver/IsSubscribed.php b/app/code/Magento/CustomerGraphQl/Model/Resolver/IsSubscribed.php index fc5691d97cbfe..f956949616c98 100644 --- a/app/code/Magento/CustomerGraphQl/Model/Resolver/IsSubscribed.php +++ b/app/code/Magento/CustomerGraphQl/Model/Resolver/IsSubscribed.php @@ -8,6 +8,7 @@ namespace Magento\CustomerGraphQl\Model\Resolver; use Magento\CustomerGraphQl\Model\Customer\GetCustomer; +use Magento\Framework\Exception\LocalizedException; use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; use Magento\Framework\GraphQl\Config\Element\Field; use Magento\Framework\GraphQl\Query\ResolverInterface; @@ -50,7 +51,11 @@ public function resolve( array $value = null, array $args = null ) { - $customer = $this->getCustomer->execute($context); + if (!isset($value['model'])) { + throw new LocalizedException(__('"model" value should be specified')); + } + /** @var Customer $customer */ + $customer = $value['model']; $status = $this->subscriberFactory->create()->loadByCustomerId((int)$customer->getId())->isSubscribed(); return (bool)$status;