[TYPO3-mvc] confusion with object manager in CommandController context

Domi djgarms at gmail.com
Fri Jan 25 04:57:08 CET 2013


Hello,

I need some hints how to resolve following issue:

I built CommandController class for sending mails as scheduler task. 
Here I recognized, that I can't use dependency injection out of the box, 
I need to inject several repositories and services.

How do I resolve this?
Currently I do:
$this->clientRepository = 
t3lib_div::makeInstance('Tx_Intranet_Domain_Repository_ClientRepository');
$this->frontendUserGroupRepository = 
t3lib_div::makeInstance('Tx_Extbase_Domain_Repository_FrontendUserGroupRepository');
$this->sendMailService = 
t3lib_div::makeInstance('Tx_Intranet_Service_SendMailService');

How do I need to use the object manager that I can make use of DI?

In the next step I call my SendMailService, which uses a lot the feature 
of DI. But now all my functions fail because of the call through the 
command controller.

ERROR: call to a member function xxx on a non-object...

How can I register my CommandController class, that he can use same 
classes as my frontend?

Thanks for any information about this.

Dominic


More information about the TYPO3-project-typo3v4mvc mailing list