php - Propel "ModelCriteria::FORMAT_ON_DEMAND" reuses same object? -


apparently using modelcriteria::format_on_demand (propelondemandformatter) not make propel hydrate objects row row , without instance pooling as documented, hydration takes place on the same object.

this means $object in example below stay same, , contents change.

$objects = objectquery::create()     ->setformatter(modelcriteria::format_on_demand)     ->find();  foreach ($objects $object) { } 

this becomes problem if propel object has additional data not mapped database table columns managed in object.

why design chosen over, say, cleanly instantiating object , hydrating it? , recommended way of working design decision?

my guess better performance because no instantiation necessary.

if code expected use on-demand fetching, should override posthydrate() class of object being fetched perform necessary object-related updates data propel not automatically map columns.

note ensureconsistency() called on "rehydration" apparently not case here.

also, not store object references. refer same object record fetched last.


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

c# - two queries in same method -