Depencency Injection not working for xclass controllers
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.
Updated by Torben Hansen over 2 years 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.