[TYPO3-50-general] Persitence: reinjectDependencies doens't work with constructor injection?
Andreas Förthner
Andreas.Foerthner at netlogix.de
Thu Jul 2 12:32:24 CEST 2009
Hi Robert,
> So it's not supported yet. However it does make sense in my eyes. So I
> suggest that you implement the following for the reinject method (with
> tests and all the klimmbimm):
>
> - Check what (constructor) arguments have been defined in the object
> configuration
> - Check if class properties with the same name exist
> - If so, reinject them through reflection after the properties have been
> injected
I think the general problem is, that the constructor might not be a simple setter, like the inject* methods. So
reinjecting the inject* things is a quite defined task and we can be sure, that there is nothing going wrong.
Reinjecting something through reflection, which usually runs through the constructor is something different. Then I'm
not sure if the constructor usually does something fancy with this object, which I won't do while reinjecting.
> Makes sense?
By doing it this way we degrade the constructor to a simple setter. Do we really want that? But in any case, where the
constructor is no simple setter, we won't be able to persist this object correctly. Perhaps we should just leave it as
it is and write a note in the documentation, that people are aware of this. For me I'll generally would not recommend
constructor injection, or am I wrong?
Greets Andi
More information about the TYPO3-project-5_0-general
mailing list