Problem/Motivation

Scanning the module with phpstan or Upgrade Status results in,

Direct injection of entity storage via $storage is not recommended. Inject Drupal\Core\Entity\EntityTypeManagerInterface and call getStorage() at the call-site instead.

Proposed resolution

Call getStorage() instead.

API changes

Conceivably a third party could have extended the offending classes, and would have to also update the dependencies to match.

Issue fork key-3627463

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

benstallings created an issue. See original summary.

benstallings’s picture

Status: Active » Needs review
ptmkenny’s picture

Version: 8.x-1.x-dev » 2.0.x-dev
Priority: Normal » Minor
Status: Needs review » Needs work

I think this should be part of Key 2.x. Key 1.x is stable and widely used; this kind of potential BC break, even if for a small number of sites, is not worth it just because phpstan said it's not recommended.

benstallings changed the visibility of the branch 3627463-direct-injection-of to hidden.

benstallings’s picture

Status: Needs work » Needs review

@ptmkenny, thank you for the feedback. I've made a new MR for 2.0.x.