Hi! On 07/08/2008 01:07 PM James Pic wrote: > Tobias Schlitt wrot
>> Refetching objects >> ================== >> >> Problem >> ------- >> >> It might be desirable to re-fetch a set of objects during a request. A >> global switch in the ezcPersistentIdentityMap instance will allow this >> to happen. If this switch is turned on, ezcPersistentIdentitySession >> should fetch the values of the affected objects from the database again >> and cache them. >> >> Solution >> -------- >> >> The $refetch option will be moved from ezcPersistentIdentityMap to >> ezcPersistentIdentitySession. If it is turned on, the session will not >> ask the identity map for an identity, but directly issue the query. The >> results of this query will be "replaced" into the identity map, using a >> new replaceObject() method. This method will check, if an identity of >> the object already exists. Is this the case, it will replace the values >> in the existing identity with the values of the submitted object and >> return the existing identity. If no identity exists, the submitted >> identity will be recorded and returned. The session will always replace >> the fetched object with the one returned from replaceObject(). > Is it ok to couple the persistent session with the identity map? > I don't mind because i will use it anyway. I agree that it should not be > optionnal. No, it's just coupled with ezcPersistentIdentitySession. The original ezcPersistentSession will stay untouched. > Will replaceObject() be used when updating an object? I think it should. When an object is updated it's identity is already up2date, since the identity map only keeps a reference. Example:: // Object is loaded first, reference is kept in identity map $obj = $identitySession->load( 'Foo', 23 ); // Object in the identity map is already updated here, since it's a // reference $obj->text = 'Some new text'; // No changes in the identity, it is already up2date $identitySession->update( $obj ); Regards, Toby -- Mit freundlichen Grüßen / Med vennlig hilsen / With kind regards Tobias Schlitt (GPG: 0xC462BC14) eZ Components Developer [EMAIL PROTECTED] | eZ Systems AS | ez.no -- Components mailing list Components@lists.ez.no http://lists.ez.no/mailman/listinfo/components