Allow AutowireTrait to wire parameters

Created on 27 November 2024, about 2 months ago

Problem/Motivation

final class ApiComponentsController implements ContainerInjectionInterface {

  use AutowireTrait;

  public function __construct(
    private readonly RendererInterface $renderer,
    #[Autowire(param: 'renderer.config')]
    private readonly array $rendererConfig,
    private readonly AccountSwitcherInterface $accountSwitcher,
  ) {}

This works if the class is autowired as a service - autowiring in the container allows parameters - but not if it is invoked directly as a controller, because AutowireTrait assumes the attribute is only used for service names.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

📌 Task
Status

Active

Version

11.0 🔥

Component

base system

Created by

🇬🇧United Kingdom longwave UK

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024