[TYPO3-50-general] Persitence: reinjectDependencies doens't work with constructor injection?
Robert Lemke
robert at typo3.org
Mon Jun 29 08:10:17 CEST 2009
Hi Andi,
On 25.06.2009, at 15:16, Andreas Förthner wrote:
> @entity
> class MyClass {
> public function __construct(\F3\FLOW3\Object\ManagerInterface
> $objectManager) {
> $this->objectManager = $objectManager;
> }
> }
>
> Should we support something like the above example? Or should we
> just deny constructor injection of not persistable objects in
> perstistable objects?
Currently it says in the comment of the reinject method:
> * Injects (again) all properties, be it through setter injection
> or through
> * reflection. Arguments can - naturally - not be injected once the
> object
> * lives, because the constructor must not be called a second time.
> *
> * This method is used for reinjecting dependencies after an object
> has been
> * reconstituted or unserialized.
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
Makes sense?
Robert
More information about the TYPO3-project-5_0-general
mailing list