[TYPO3-mvc] initializeObject() pointless?

Martin Kutschker masi-no at spam-typo3.org
Thu Jun 17 12:06:56 CEST 2010


Sebastian Kurfürst schrieb:
> Hey,
> 
>> So thrice in total?
> Nope, I have explained it wrong. Let's try again:
> 
> If the FLOW3 object manager creates an object _from scratch_:
> - it calls the constructor
> - it injects all dependencies
> - it calls initializeObject(CREATED)
> This happens when an object is needed because of dependency injection or
> because somebody does $objectManager->create('ObjectName');
> 
> If the FLOW3 Object Manager recreates an object (this happens mostly
> when it is reconstituted from the database), the following happens:
> - it injects all dependencies
> - NEW: it calls initializeObject(RECREATED)
> 
> This is because you most probably want to do the same initialization on
> creation and recreation of an object.

Ok, so the method call is moved from before thawing to after after thawing with an additional
parameter. This if fine with me. But wouldn't we need in Extbase to call the old method before just
to preserve backwards compatibility? OTOH Extbase isn't so widespread enough that a !!! in the
Changelog wouldn' be sufficient.

> However, I agree with you that the DataMapper needs to be extended;
> though I could imagine to place these extensions not in the Domain
> Model, but in a custom class which is tied to the data mapper.

Of course.

What I had i mind that we move some functionality from the data mapper to the data map. And that the
data map factory would return the right data map for the requested model/table. The data map factory
already does some magic by taking parsing the persistence configuration. It would be simple and
consistent to add a dataMap.class configuration to the configuration.

So the data mapper could stay a singleton, but each model could get custom mapping if required.

Masi


More information about the TYPO3-project-typo3v4mvc mailing list