[TYPO3-mvc] How should/can I pass parameters to an object's constructor using dependency injection?

Martin Kutschker masi-no at spam-typo3.org
Fri Nov 19 16:16:44 CET 2010


Am 19.11.2010 15:28, schrieb Simon Tuck:
> 
> As you can see I have a class "ThisClass" which needs to inject "ThatClass", but ThatClass's
> constructor takes an argument. If ThatClass hasn't been instantiated how will the the DI container
> be able to instantiate ThatClass without being passed it's constructor parameter?

I guess that in FLOW3 this is done within a YAML configuration file. I didn't read the docs for DI
in Extbase, but I guess some configuration is here necessary as well.

The ugly issue in your example is that you don't init your singleton with, say, a configuration
parameter like a log-file path, but that it depends on yet another object which in turn must be
instantiated magically.

Masi


More information about the TYPO3-project-typo3v4mvc mailing list