getCustomerAddress = $getCustomerAddress; $this->updateCustomerAddress = $updateCustomerAddress; $this->extractCustomerAddressData = $extractCustomerAddressData; } /** * @inheritdoc */ public function resolve( Field $field, $context, ResolveInfo $info, array $value = null, array $args = null ) { /** @var ContextInterface $context */ if (false === $context->getExtensionAttributes()->getIsCustomer()) { throw new GraphQlAuthorizationException(__('The current customer isn\'t authorized.')); } if (empty($args['id'])) { throw new GraphQlInputException(__('Address "id" value must be specified')); } if (empty($args['input']) || !is_array($args['input'])) { throw new GraphQlInputException(__('"input" value must be specified')); } $address = $this->getCustomerAddress->execute((int)$args['id'], $context->getUserId()); $this->updateCustomerAddress->execute($address, $args['input']); return $this->extractCustomerAddressData->execute($address); } }