Skip to content

Commands can not be autowired #25

Description

@helmutstrasser

TYPO3 v11.5.33
PHP v8.2
georgringer/redirect-generator v1.0.0

For the commands ImportRedirectCommand and ExportRedirectCommand the front- and backend throw the exception

(1/1) Symfony\Component\DependencyInjection\Exception\RuntimeException Cannot autowire service "GeorgRinger\RedirectGenerator\Command\ExportRedirectCommand": argument "$name" of method "__construct()" is type-hinted "string", you should configure its value explicitly.

If I change the order of the arguments in the according constructor from

public function __construct( string $name = null, NotificationHandler $notificationHandler ) {}

to

public function __construct( NotificationHandler $notificationHandler, string $name = null ) {}

everything is working.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions