Problem/Motivation

The MyrestHelper class, despite being a service, contains methods that use \Drupal::service() and \Drupal::entityTypeManager(). This pattern is deprecated and hinders unit testing.

Proposed resolution

  • Update MyrestHelper::__construct to accept EntityTypeManagerInterface and RequestStack.
  • Update myrest.services.yml to inject these services.
  • Remove static calls from getEntityTypeManager() and getRequestStack().

Remaining tasks

Perform refactoring and verify that all service consumers are working correctly.

Issue fork myrest-3582662

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

sergeydruua created an issue. See original summary.

sergeydruua’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

sergeydruua’s picture

Status: Fixed » Closed (fixed)