Bug #91750
closedDepencency Injection not working for xclass controllers
0%
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.
Updated by Rémy DANIEL over 3 years ago
Could you add some steps to reproduce?
Dependency injection issue may have several root causes.
Updated by Torben Hansen over 3 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.
Updated by Torben Hansen over 3 years ago
A solution for the problem was provided on GitHub: https://github.com/derhansen/xclass_di/issues/1
This issue can be closed.
Updated by Benjamin Franzke over 2 years ago
- Related to Bug #97149: GeneralUtility::makeinstance() container fetch should be allowed with or without arguments. added
Updated by Benjamin Franzke over 2 years ago
- Related to deleted (Bug #97149: GeneralUtility::makeinstance() container fetch should be allowed with or without arguments.)