[TYPO3-mvc] initializeObject() pointless?

Sebastian Kurfürst sebastian at typo3.org
Thu Jun 17 11:42:23 CEST 2010


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.

> This will come in handy. Anyway, I now much more in favour of an extended data mapping scheme. The
> current code (Extbase) isn't extensible at all. Fiddling with a "hook" after reconstitution to do
> proper custom mapping is only a hack. A much better IMHO is to give the data mapper the necessary
> info it needs.
We really have to watch out to not have too many "magic methods" in the
Domain Model, as it should be "plain old PHP", and you should have all
the freedom you need inside there.

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.

Let's discuss this at T3DD, I'd suggest -- as some people from FLOW3
should join this discussion as well :-)

Looking forward to meeting all of you at T3DD,
Sebastian


More information about the TYPO3-project-typo3v4mvc mailing list