Skip to content

Instantly share code, notes, and snippets.

@joeyblake
Created September 9, 2011 15:46
Show Gist options
  • Save joeyblake/1206562 to your computer and use it in GitHub Desktop.
Save joeyblake/1206562 to your computer and use it in GitHub Desktop.
Get ORM Model Extra Attribute Data
<cffunction name="getModelDescDefault">
<cfargument name="model" required="true">
<cfset z = CreateObject('models.#arguments.model#')>
<cfset fieldStruct = {}>
<cfloop array="#getMetaData(z).properties#" index="i">
<cfif StructKeyExists(i,'desc')>
<cfset fieldStruct['#i.name#']['desc'] = #i.desc#>
<cfset fieldStruct['#i.name#']['default'] = #i.default#>
</cfif>
</cfloop>
<cfreturn fieldStruct>
</cffunction>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment