Problem/Motivation

With the new graphql version I get the following error:

Fatal error: Declaration of Drupal\access_unpublished\Plugin\GraphQL\DataProducer\AccessUnpublishedRouteLoad::resolveField(Drupal\graphql\GraphQL\Execution\FieldContext $field) must be compatible with Drupal\graphql\Plugin\GraphQL\DataProducer\DataProducerPluginBase::resolveField(Drupal\graphql\GraphQL\Execution\FieldContext $field): mixed in /var/www/html/docroot/modules/contrib/access_unpublished/src/Plugin/GraphQL/DataProducer/AccessUnpublishedRouteLoad.php on line 76

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

chr.fritsch created an issue. See original summary.

chr.fritsch’s picture

Status: Active » Needs review
generalredneck’s picture

Status: Needs review » Needs work

so a few things. This change, if introduced to our codebase would break current implementations using the currently suppported 8.x-3.6 and 8.x-4.12 versions of graphql. The version you are testing is definitely 5.0.0-alpha3

Even "require-dev" points at 8.x-4.12 so you would need to fix that at the very least in addition to this change.

We may have to write some code that pulls in a version of the plugin based on the version of graphql that a site is using. Not quite sure how to accomplish that.

chr.fritsch’s picture

Status: Needs work » Needs review

access_unpublished has never supported GraphQL 3. For GraphQL 4, I’ve reviewed the changes and confirmed it still works. Adding return types in child classes should be fine. The only requirement is that if a return type is defined in the parent class, all child classes must implement it consistently as well.

volkerk’s picture

Status: Needs review » Reviewed & tested by the community

Lgtm

chr.fritsch’s picture

  • chr.fritsch committed 6306c710 on 8.x-1.x
    Issue #3542258 by chr.fritsch, generalredneck, volkerk:...
chr.fritsch’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.