Slash prefix prevents autowiring from working

Created on 5 October 2023, about 1 year ago

Problem/Motivation

When autowiring a repository class (NodeRepository for example) matching service cannot be found. This is because there is a backslash in front of the Drupal namespace.

Steps to reproduce

Create a service and class.
for the service, set autowire to true
In the class, autowire NodeRepository in the constructor:

  public function __construct(
    protected NodeRepository $nodeRepository
  ) {}

Proposed resolution

Remove \ infront of Drupal namespace in services file.

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

🇧🇪Belgium mauro_

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024