Automattic\WooCommerce\Internal\Api\Autogenerated\GraphQLMutations
UpdateCoupon::resolve
Method of the class: UpdateCoupon{}
No Hooks.
Returns
null. Nothing (null).
Usage
$result = UpdateCoupon::resolve( $root, $args, $context, $info ): mixed;
- $root(mixed) (required)
- .
- $args(array) (required)
- .
- $context(mixed) (required)
- .
- $info(ResolveInfo) (required)
- .
UpdateCoupon::resolve() UpdateCoupon::resolve code WC 10.9.1
public static function resolve( mixed $root, array $args, mixed $context, ResolveInfo $info ): mixed {
// Standalone authorization gate: no authorize() method on the command,
// so the autodiscovered authorization attributes are the sole guard.
if ( ! self::compute_preauthorized( $context['principal'] ) ) {
throw ResolverHelpers::build_authorization_error( $context['principal'] );
}
// Publish the root query's metadata so downstream field-level
// authorization gates can read it via `$_metadata['query']`.
// $context is an ArrayObject (see GraphQLController::process_request())
// so the mutation propagates to nested resolvers.
$context['_query_metadata'] = array();
$command = \Automattic\WooCommerce\Api\Infrastructure\ClassResolver::resolve_class( UpdateCouponCommand::class );
$execute_args = array();
if ( array_key_exists( 'input', $args ) ) {
$execute_args['input'] = self::convert_update_coupon_input( $args['input'] );
}
$result = ResolverHelpers::execute_command( $command, $execute_args );
return $result;
}