Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix deprecated getArgs, getInfo, ${} #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/Loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ function op_filter_graphql_connection_amount_requested($amount, $resolver)
*/
static function get_page_size(AbstractConnectionResolver $resolver)
{
$args = $resolver->getArgs();
$args = $resolver->get_args();
return intval($args['where']['offsetPagination']['size'] ?? 0);
}

static function is_offset_resolver(AbstractConnectionResolver $resolver)
{
$args = $resolver->getArgs();
$args = $resolver->get_args();
return isset($args['where']['offsetPagination']);
}

Expand All @@ -90,7 +90,7 @@ function op_filter_graphql_connection_query_args(
$query_args,
AbstractConnectionResolver $resolver
) {
$info = $resolver->getInfo();
$info = $resolver->get_info();
$selection_set = $info->getFieldSelection(2);

if (!isset($selection_set['pageInfo']['offsetPagination']['total'])) {
Expand All @@ -112,10 +112,10 @@ function op_filter_graphql_connection_query_args(
static function add_post_type_fields(\WP_Post_Type $post_type_object)
{
$type = ucfirst($post_type_object->graphql_single_name);
register_graphql_fields("RootQueryTo${type}ConnectionWhereArgs", [
register_graphql_fields("RootQueryTo{$type}ConnectionWhereArgs", [
'offsetPagination' => [
'type' => 'OffsetPagination',
'description' => "Paginate ${type}s with offsets",
'description' => "Paginate {$type}s with offsets",
],
]);
}
Expand All @@ -126,7 +126,7 @@ function op_filter_graphql_connection_page_info(
) {
$size = self::get_page_size($resolver);
$query = $resolver->get_query();
$args = $resolver->getArgs();
$args = $resolver->get_args();
$offset = $args['where']['offsetPagination']['offset'] ?? 0;

$total = null;
Expand Down