[TYPO3-mvc] dependency injection

Felix Oertel mehl at foertel.com
Thu Jul 29 14:18:37 CEST 2010


hey guys,

** be aware: all this is just developer stuff ! nothing happened to the 
"real" extbase (yet) ... no reason to panic ;-) **

thomas maroschik and I played around with variable storage backends for 
the persistence manager a little. as jochen mentioned before, we'll run 
into trouble with all this if we don't have dependency injection.

i created a branch [1] and added some very very basic DI functionality 
to the extbase core. to use it, you have to use 
objectManager->get('Name_Of_Class'); instead of new or 
t3lib_div::makeInstance().

did you just think about how to get the objectManager into your 
controller? uh uh ! just add this [2] to every class you want to use the 
objectManager in ... it will be there* magically ... that's dependency 
injection ! :-)

* it will get injected as long as the class itself is fetched via 
objectManager->get(). it most likely is, since (nearly) the hole extbase 
code uses objectManager->get() now ...

please notice: this is just playing around. it's not said that this 
makes it's way into the core. i just tried to find a clean, fast and 
simple solution ...
for now there is neither configuration nor error handling. i think 
thomas and i will take care of this during the next days and weekend ...

please check it out, play around with this, test your extensions against 
it and give massive feedback.

regards, foertel

[1] 
https://svn.typo3.org/TYPO3v4/CoreProjects/MVC/extbase/branches/dependency_injection
[2] http://cxg.de/_371999.htm


More information about the TYPO3-project-typo3v4mvc mailing list