Problem/Motivation

Pathauto provides several services, but they cannot be autowired. See core for reference: #3325557: Enable more service autowiring by adding interface aliases to core modules

Steps to reproduce

  1. Implement a service that injects @pathauto.generator
  2. Enable autowiring for the new service

Results in the following error message:
Cannot autowire service "[service name]": argument "$pathautoGenerator" of method "[CLASS_NAME]::__construct()" references interface "Drupal\pathauto\PathautoGeneratorInterface" but no such service exists. You should maybe alias this interface to the existing "pathauto.generator" service.

Proposed resolution

Allow pathauto services to be autowired

Remaining tasks

  1. Write a merge request
  2. Review
  3. Commit

User interface changes

None

API changes

Pathauto services can now be autowired

Data model changes

None

Issue fork pathauto-3533941

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

idebr created an issue. See original summary.

idebr’s picture

Status: Active » Needs review
berdir’s picture

Status: Needs review » Fixed

Probably could add the alias type manager as well, doesn't need to be an interface, but is probably also not really needed. But we can still o that elsewhere. Changing our own services to autowire can also be done separately.

Merged.

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

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

Maintainers, please credit people who helped resolve this issue.

  • berdir committed 3de5ac82 on 8.x-1.x authored by idebr
    [#3533941] feat: Allow pathauto services to be autowired
    
    By: idebr
    

Status: Fixed » Closed (fixed)

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