Skip to content

Commit 8831221

Browse files
committed
magento/graphql-ce#741: Add extension point to set custom parameters to Query Context object
1 parent ac05279 commit 8831221

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

app/code/Magento/CustomerGraphQl/Model/Resolver/IsSubscribed.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
namespace Magento\CustomerGraphQl\Model\Resolver;
99

1010
use Magento\CustomerGraphQl\Model\Customer\GetCustomer;
11+
use Magento\Framework\Exception\LocalizedException;
1112
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
1213
use Magento\Framework\GraphQl\Config\Element\Field;
1314
use Magento\Framework\GraphQl\Query\ResolverInterface;
@@ -50,7 +51,11 @@ public function resolve(
5051
array $value = null,
5152
array $args = null
5253
) {
53-
$customer = $this->getCustomer->execute($context);
54+
if (!isset($value['model'])) {
55+
throw new LocalizedException(__('"model" value should be specified'));
56+
}
57+
/** @var Customer $customer */
58+
$customer = $value['model'];
5459

5560
$status = $this->subscriberFactory->create()->loadByCustomerId((int)$customer->getId())->isSubscribed();
5661
return (bool)$status;

0 commit comments

Comments
 (0)