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

Andreas Förthner Andreas.Foerthner at netlogix.de
Thu Jun 25 15:16:03 CEST 2009


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.

Should we support something like the above example? Or should we just deny constructor injection of not persistable 
objects in perstistable objects?

Or have I overlooked something and the mentioned scenario is not a problem at all?

Greets Andi


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