Problem/Motivation

ConfigurableResourceType extends the ResourceType class. The configurable lives in this module, the base class lives in the JSON API module. Given that ResourceType is an internal class we break JSON API often.

This happens whenever the __construct class gets an argument. That is because on top of the base arguments we need to pass additional services to make ConfigurableResourceType configurable.

We want to avoid updating ConfigurableResourceType every time ResourceType::__construct is updated.

Proposed resolution

Use the setter injection pattern instead of the constructor injection pattern for ConfigurableResourceType.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

e0ipso created an issue. See original summary.

e0ipso’s picture

Let's see what breaks with this patch.

e0ipso’s picture

Status: Active » Needs review

Status: Needs review » Needs work

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

e0ipso’s picture

e0ipso’s picture

Status: Needs work » Needs review
e0ipso’s picture

Allow disabling via isInternal.

e0ipso’s picture

Once #2995111: shouldBeInternalResourceType et al. should receive the resource type, not the entity type is backported to 1.x we can remove the setInternal and override static:: shouldBeInternalResourceType to check for the config entity value.

  • e0ipso committed 072376f on 8.x-2.x
    Issue #2992557 by e0ipso: Inject additional services manually to...
e0ipso’s picture

Status: Needs review » Fixed
Wim Leers’s picture

Nice hardening!

Status: Fixed » Closed (fixed)

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