Enable autowiring in Hux classes

Created on 30 May 2023, about 1 year ago
Updated 28 November 2023, 7 months ago

Problem/Motivation

I like to use constructor injection with autowired parameters.
See https://www.drupal.org/project/issues/drupal?text=autowire&status=All

Steps to reproduce

Proposed resolution

All we need is this in HuxCompilerPass:

      if ((new \ReflectionClass($className))->isSubclassOf(ContainerInjectionInterface::class)) {
        $definition
          ->setFactory([$className, 'create'])
          ->setArguments([new Reference('service_container')]);
      }
      else {
        $definition->setAutowired(TRUE);
      }

Remaining tasks

User interface changes

API changes

Data model changes

Feature request
Status

Fixed

Version

1.2

Component

Code

Created by

🇩🇪Germany donquixote

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

Merge Requests

Comments & Activities

Production build 0.69.0 2024