[TYPO3-50-general] Persitence: reinjectDependencies doens't work with constructor injection?

Martin Kutschker masi-no at spam-typo3.org
Fri Jul 3 10:23:48 CEST 2009


Andreas Förthner schrieb:
> Hi,
> 
> I just stumbled over the following problem: I have a class with
> constructor injection which is also persisted, like this one:
> 
> @entity
> class MyClass {
>     public function __construct(\F3\FLOW3\Object\ManagerInterface
> $objectManager) {
>         $this->objectManager = $objectManager;
>     }
> }
> 
> I'm pretty sure that, after reconstituting the object back from the CR,
> the object manager won't be there anymore. On reconstituting objects the
> reinjectDependencies-Method of the object builder is called. But this
> method only cares for inject*-Methods or properties annotated with @inject.

<view type="outsider">
If the object needs the objectManager to persist and acts as a setter,
what's wrong with simply annotating the objectManager property. Why do
you expect some magic here?

There is no general rule that any of the actual constructor arguments
must persist.
</view>

Masi


More information about the TYPO3-project-5_0-general mailing list