Hi All, #random_find_of_the_day
So I stumbled across something ... I didn't know you can programmatically add/edit/remove attributes of properties defined in a component? Not only that but the programmatically adjusted attributes will persist for life of the application (not sure I understand why that is [CF Admin setting?])! Why is that useful? I don't know. For example, take the classic component definition called person.cfc: <cfcomponent> <cfproperty name="FirstName"> <cfproperty name="LastName"> </cfcomponent> See, two properties, one attribute per property, 'name'. Then in a .cfm instantiate the object and get the metadata: <cfset obj = CreateObject("component","person")> <cfset metaData = GetMetaData(obj)> <cfset arr = metaData.properties> If you dump the #arr# you should see a 2 element array. Each element should have a struct with the key 'NAME' and a value of 'FirstName' for the first and 'LastName' for the second. Add an extra attribute to the first property, by adding an extra struct key to the first property: <cfset arr[1]["WHY"] = "is this useful?"> Now create another .cfm where all you do is instantiate the object again, get the metadata properties and dump the resulting array. The struct in the first element of the array should now have two keys 'NAME' and 'WHY'. Interestingly you can't add extra properties i.e. ArrayAppend() <guess>maybe because it is a protected CF runtime data type; well that is what the error suggests when I tried</guess> Like I said, I've no idea why you'd do this or even if it is useful. -- You received this message because you are subscribed to the Google Groups "cfaussie" group. To post to this group, send email to cfaussie@googlegroups.com. To unsubscribe from this group, send email to cfaussie+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/cfaussie?hl=en.