Bug #91750

Depencency Injection not working for xclass controllers

Added by Torben Hansen 12 months ago. Updated 3 days ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2020-07-06
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
11
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

When I extend an Extbase Controller using xclass, it seems not to be possible to use Dependency Injection for the xclassed controller. I tried to use constructor injection and injectMethod injection, but both does not work. Tested in TYPO3 v9 and v10.

If this is intended behavior, I will update the documentation about this. But first I need an explanation either why this is not working or how DI can be used in xclassed controllers.

#1

Updated by DANIEL Rémy about 2 months ago

Could you add some steps to reproduce?
Dependency injection issue may have several root causes.

#2

Updated by Torben Hansen 21 days ago

  • TYPO3 Version changed from 9 to 11

I created this https://github.com/derhansen/xclass_di demo extension (for current master), where I xclass TYPO3\CMS\Belog\Controller\BackendLogController and try to inject TYPO3\CMS\Core\Mail\Mailer using constructor injection, this fails since the constructor is called with too few arguments.

Would be nice to know if I'm wrong somewhere or if this is currently not supported.

#3

Updated by Torben Hansen 18 days ago

A solution for the problem was provided on GitHub: https://github.com/derhansen/xclass_di/issues/1

This issue can be closed.

#4

Updated by Christian Kuhn 3 days ago

  • Status changed from New to Closed

Thanks!

Also available in: Atom PDF