[TYPO3-mvc] dependency injection
Sebastian Kurfürst
sebastian at typo3.org
Fri Jul 30 07:29:49 CEST 2010
Hi Felix,
thanks for your ideas! I have looked at your patch, and have some
comments ready (hope you don't mind the nit-picking ;) )
- Instead of "Object_Manager", it should be called
"Object_ObjectManager" (same for the ManagerInterface)
- "getObject" should be called "get", and there should be an additional
method "create" inside ObjectManagerInterface.
- "getObject" can be removed inside Object_Manager, as it has never been
a public API, and only used inside Extbase, right?
- please remove the API annotations for now, as it is not yet stable
enough for a public API.
- you should call an "initializeObject" after DI has been finished, as
you cannot use the constructor for such initializations.
The main issue I see right now is the speed problem inside
"injectDependencies", as you use uncached reflection there. I am not
sure how we could fix this issue in a performant way; maybe using the
Extbase Reflection Service could help. As we have one Database Request
anyways when the Reflection Service is asked for the first time, this
should not get worse... But we'd definitely need to profile this and
measure if Extbase gets slower by DI. (The Profiler whould be helpful
now ;-) ;-) )
To solve the speed issue, FLOW3 creates a PHP file which hard-wires the
dependencies of objects together -- and this is then really fast, but I
fear that's not a feasible solution in Extbase.
Thanks again for all the work :-) I think it's a nice feature, and if we
solve the speed issue, I see no problem in including it in Extbase core.
It's no constructor injection, no @inject annotation and the like, but
it's definitely enough to get people started with Dependency Injection.
Greets,
Sebastian
More information about the TYPO3-project-typo3v4mvc
mailing list