Closed (outdated)
Project:
Drupal core
Version:
main
Component:
base system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
27 Nov 2024 at 18:54 UTC
Updated:
1 Apr 2026 at 15:28 UTC
Jump to comment: Most recent
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.
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
Comment #2
longwaveComment #4
wim leersDiscovered by @longwave at #3490069-3: [upstream] [PP-1] Auto-register XB's controllers' invokable services.
Comment #6
wim leersPer @catch's comments #17 and #19 on #3490300, this is now pretty much a hard blocker.
Comment #9
gabesulliceComment #10
gabesulliceComment #11
longwaveDuplicate of #3558292: Support passing container parameters with the Autowire attribute in AutowireTrait and AutowiredInstanceTrait ?
Comment #12
dcam commentedThere's some duplication at the very least. They both modify
AutowiredInstanceTraitin the same place, so one of them is going to have to be rebased. The other issue is RTBC and this one needs a rebase. I'm going to set this to Needs Work because of that, but maybe we need to wait on this until the other is committed.Comment #13
gabesulliceI believe #3558292: Support passing container parameters with the Autowire attribute in AutowireTrait and AutowiredInstanceTrait addressed this issue.