|
3 | 3 | namespace Drupal\os2forms_digital_post\Drush\Commands; |
4 | 4 |
|
5 | 5 | use Drupal\Component\Serialization\Yaml; |
| 6 | +use Drupal\Core\DependencyInjection\AutowireTrait; |
6 | 7 | use Drupal\Core\Utility\Token; |
7 | 8 | use Drupal\entity_print\Plugin\EntityPrintPluginManagerInterface; |
8 | 9 | use Drupal\os2forms_digital_post\Helper\DigitalPostHelper; |
|
12 | 13 | use ItkDev\Serviceplatformen\Service\SF1601\SF1601; |
13 | 14 | use Symfony\Component\Console\Exception\InvalidArgumentException; |
14 | 15 | use Symfony\Component\Console\Style\SymfonyStyle; |
15 | | -use Symfony\Component\DependencyInjection\ContainerInterface; |
| 16 | +use Symfony\Component\DependencyInjection\Attribute\Autowire; |
16 | 17 | use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface; |
17 | 18 |
|
18 | 19 | /** |
19 | 20 | * Test commands for digital post. |
20 | 21 | */ |
21 | 22 | final class DigitalPostTestCommands extends DrushCommands { |
| 23 | + use AutowireTrait; |
22 | 24 |
|
23 | 25 | /** |
24 | 26 | * Constructor. |
25 | 27 | */ |
26 | 28 | public function __construct( |
27 | 29 | private readonly DigitalPostHelper $digitalPostHelper, |
28 | 30 | private readonly Token $token, |
| 31 | + #[Autowire(service: 'plugin.manager.entity_print.print_engine')] |
29 | 32 | private readonly EntityPrintPluginManagerInterface $entityPrintPluginManager, |
30 | 33 | private readonly Settings $digitalPostSettings, |
31 | 34 | ) { |
32 | 35 | } |
33 | 36 |
|
34 | | - /** |
35 | | - * {@inheritdoc} |
36 | | - */ |
37 | | - public static function create(ContainerInterface $container): self { |
38 | | - return new static( |
39 | | - $container->get(DigitalPostHelper::class), |
40 | | - $container->get('token'), |
41 | | - $container->get('plugin.manager.entity_print.print_engine'), |
42 | | - $container->get(Settings::class), |
43 | | - ); |
44 | | - } |
45 | | - |
46 | 37 | /** |
47 | 38 | * Send digital post. |
48 | 39 | * |
|
0 commit comments