[TYPO3-mvc] Get the injecting object within the injected object
xima media
wiebke.lauke at xima.de
Thu Oct 2 10:46:53 CEST 2014
Hi all,
I am providing a tools extension with services and so on for customer extensions. For this I'm injecting the service classes to my customer classes. Is there a way within the injected object to access the object "does" the the injections? Like:
public function visitInjector($injector) {
$this->something = $injector-something();
}
(In Typo3 < 6 the following worked:
class Tx_XYZ_Controller_TestController extends Tx_Extbase_MVC_Controller_ActionController {
/**
*
* @var TxXmTools\Classes\Helpers\Typo3Services
* @inject
*/
protected $typo3Services;
..
}
namespace TxXmTools\Classes\Helpers;
class Typo3Services {
/**
*
* @var Tx_Extbase_Configuration_ConfigurationManagerInterface
* @inject
*/
protected $configurationManagerInterface;
public function initializeObject() {
$this->configuration = $this->configurationManagerInterface->getConfiguration (\Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
$this->extensionName = $this->configuration ['extensionName'];
...
}
}
which returned me my extension name xyz, so this class was good to be used generically, even though that way always seemed to me to be a bad practice. )
I'd love to work that out in a a better way, and accessing my injecting classes within my tools extension seems a good way to me.
Thanks a lot!
Wolfram
More information about the TYPO3-project-typo3v4mvc
mailing list