The latest commit to the JSONAPI module and its changes to ResourceTypeRepository from issue #2937961: ResourceType should provide related ResourceTypes seems to break sites with jsonapi_extras installed with the following:

PHP Fatal error: Uncaught TypeError: Argument 3 passed to Drupal\jsonapi_extras\ResourceType\ConfigurableResourceTypeRepository::__construct() must implement interface Drupal\Core\Entity\EntityRepositoryInterface, instance of Drupal\Core\Entity\EntityFieldManager given, called in /var/www/drupalvm/web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 282 and defined in /var/www/drupalvm/web/modules/contrib/jsonapi_extras/src/ResourceType/ConfigurableResourceTypeRepository.php:50

Attaching a patch that should bring things in line with the upstream changes. Marking this issue critical because it has site-breaking impacts.

Comments

logickal created an issue. See original summary.

logickal’s picture

logickal’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 2: fix_upstream_ConfigurableResourceTypeRepository-2941481-2.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

logickal’s picture

Re-rolling the patch to remove extraneous newline causing phpcs violation. I suspect the test failures are related to a version discrepancy between jsonapi and jsonapi_extras on the test-runner, but I will have to dive deeper.

logickal’s picture

Issue summary: View changes
e0ipso’s picture

Thanks for this!

Initial review:

  1. +++ b/src/ResourceType/ConfigurableResourceTypeRepository.php
    @@ -30,6 +31,13 @@ class ConfigurableResourceTypeRepository extends ResourceTypeRepository {
    +  /**
    +   * The entity field manager.
    +   *
    +   * @var \Drupal\Core\Entity\EntityFieldManagerInterface
    +   */
    +  protected $entityFieldManager;
    

    No need to re-declare this here if it's in the parent class.

  2. +++ b/src/ResourceType/ConfigurableResourceTypeRepository.php
    @@ -47,11 +55,13 @@ class ConfigurableResourceTypeRepository extends ResourceTypeRepository {
    +    $this->entityFieldManager = $entityFieldManager;
    

    Let's make $this->entityFieldManager = $entityFieldManager into $this->entityFieldManager = $entity_field_manager

  3. +++ b/src/ResourceType/ConfigurableResourceTypeRepository.php
    @@ -47,11 +55,13 @@ class ConfigurableResourceTypeRepository extends ResourceTypeRepository {
    +    $this->bundleManager = $bundle_manager;
    

    Is $this->bundleManager declared in one of the parent classes?

    If not, we need to declare it here.

  • e0ipso committed a74c277 on 8.x-1.x authored by logickal
    Issue #2941481 by logickal, e0ipso: Breaking upstream JsonAPI module...
e0ipso’s picture

Status: Needs work » Fixed

You'll need to update to the latest jsonapi-dev for this to work.

Status: Fixed » Closed (fixed)

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