In the Pier-Magma integration there are instances od PRContext whose #properties instance var could really use zeroing to nil, before it is ever persisted.
I had a look at asStorageObject, but this seems to need an object that has its own graph. I assume that this means that it is representable as a discrete entity, rather than as part of the overall objects graph.
My current solution is to ensure that my 'dangerous' object is always sent #magmaCopy before it is stored in the persistent model, and also ensure that it is always sent #magmaCopy before it is likely to be used.
This doesnt seem like the most efficient way of doing things. I thought of using preSerialisation, but looking at the code it appears that the result of preserializing has to be the same object, it cant be a copy, otherwise it gets treated as a StorageObject.
At present it looks as though I can combine, copying my dangerous object, so as not to disturb the users of the dangerous properties, and using preserialisation to zap the properties before storing.
any advice would be appreciated.
Keith
___________________________________________________________ To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com