Project

General

Profile

Actions

Bug #91750

closed

Depencency Injection not working for xclass controllers

Added by Torben Hansen almost 4 years ago. Updated almost 3 years 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.

Actions #1

Updated by Rémy DANIEL almost 3 years ago

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

Actions #2

Updated by Torben Hansen almost 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.

Actions #3

Updated by Torben Hansen almost 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.

Actions #4

Updated by Christian Kuhn almost 3 years ago

  • Status changed from New to Closed

Thanks!

Actions #5

Updated by Benjamin Franzke about 2 years ago

  • Related to Bug #97149: GeneralUtility::makeinstance() container fetch should be allowed with or without arguments. added
Actions #6

Updated by Benjamin Franzke about 2 years ago

  • Related to deleted (Bug #97149: GeneralUtility::makeinstance() container fetch should be allowed with or without arguments.)
Actions

Also available in: Atom PDF