getComponentProps(object)
Last updated May 18, 2012
Version: 3 | Requires: CF6 | Library: DataManipulationLib
Description:
Pass in the result from getMetaData() and returns all properties within the cfc and those it extends. It is recursive. (I didn't find any true time difference and this seemed cleaner). This does not include the base 'component' tag in it's search. I couldn't see anyone putting properties there anyways. A special value will be added to each propery, foundIn, that represents which CFC a property was found in. This is useful in case both a child and parent CFC share the same property.
Return Values:
Returns an array of structs.
Example:
<cfset whatever = createobject('component', 'foo.bar')>
<cfset dummyArray = getComponentProps( getMetaData( whatever ))>
<cfdump var="#dummyArray#" />
Parameters:
Name | Description | Required |
---|---|---|
object | The metadata from a component. | Yes |
Full UDF Source:
/**
* Returns an array of all properties in cfc's metadata, inherited or not.
* v2 was submitted by salvatore fusto
* v3 ditto
*
* @param object The metadata from a component. (Required)
* @return Returns an array of structs.
* @author Robby Lansaw (robby@ohsogooey.com)
* @version 3, May 18, 2012
*/
function getComponentProps(object) {
var propArray = arrayNew(1);
if (structKeyExists(object,'properties')) {
propArray = object.properties;
}
if (structKeyExists(object,'extends')) {
propArray.addAll(getComponentProps(object.extends ));
}
return propArray;
}
Search CFLib.org
Latest Additions
Raymond Camden added
QueryDeleteRows
November 04, 2017
Leigh added
nullPad
May 11, 2016
Raymond Camden added
stripHTML
May 10, 2016
Kevin Cotton added
date2ExcelDate
May 05, 2016
Raymond Camden added
CapFirst
April 25, 2016