[FLOW3-general] Constructor injection in models?

Tommy Seus tommy.seus at gmail.com
Thu Apr 22 21:41:16 CEST 2010


There are two other methods to inject objects.

@inject or injectMethod

http://flow3.typo3.org/documentation/manuals/flow3/flow3.objectframework/#flow3.objectframework.objectdependencies

Am 22.04.2010 19:12, schrieb Michael Sauter:
> Hi,
>
> is constructor injection somehow possible in models (entities)?
>
> I tried to use it, but upon adding/updating, I got an exception
> ("Missing constructor argument") inside PropertyMapper::buildObject().
> The controller seems to try to get the constructor arguments from the
> arguments passed from the form. But of course I don't want to pass
> around my object ... I want to get it injected ;)
>
> Am I doing something wrong there? If not, would it be possible to let
> the object manager do its magic before we throw the excpetion in there?
>
> Besides that - any other possibilites to solve this issue without
> constructor injection? ATM, I can only think of a custom init()-method
> that I have to call every time in my code before using the object ...
> (which is not that bad, because setter/property injection works, and
> that's already awesome!)
>
> Thanks,
> ~michael
> _______________________________________________
> FLOW3-general mailing list
> FLOW3-general at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/flow3-general



More information about the FLOW3-general mailing list