I have a routine where I dynamically instantiate persistent objects using reflection. One of the properties of the object, which is also a persistent object, fails when I try to instantiate it using reflection ($Property). It fails because the property has been deleted from the database. Which makes sense but I can't seem to get the Id of that property (23). when I ZWrite the object I can see the property id in the print out.
+----------------- swizzled references ---------------
| i%PropID = 23
| r%PropID = ""
I have not been able to figure out how to get access to the i%ProdID value. If someone can help i would greatly appreciate it.
I'm using recursion to get an object’s properties and each propery’s subsequent properties (if they extents persistent) and so on, but in cases where the property is not actually persisted (somehow got deleted), i'd still like to get the id. I've thought of using sql but i want to keep away from that if at all possible.
The solution was to override the getter for that property object and is explained here:
https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=GOBJ_propmethods
S getter = propertyName_"GetObjectId"
try {
S id = $METHOD(object, getter)
} catch (ex) {}
return $G(id)