Skip to content

Commit

Permalink
magento/graphql-ce#741: Add extension point to set custom parameters …
Browse files Browse the repository at this point in the history
…to Query Context object
  • Loading branch information
naydav committed Jun 13, 2019
1 parent ac05279 commit 8831221
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 8831221

Please sign in to comment.