Reputation: 107
I'm trying to load a persistent ORM Entity by retrieving its name from the database but it keeps giving me an error. The error states no CFC with the name exists but it displays the name of the CF clearly in the error and it is correct. Perhaps this is something that is not possible?
Here's the sample code (some variables are obviously dynamically generated but not part of the sample below)
<cfset friendlyColumn = entityLoad("importFriendlyNames",{friendly_name=#matchingStruct[columns]#})>
<cfloop array="#friendlyColumn#" index="fl">
<!--- find the entity from the value in the database -- this fails --->
<cfset newEntity = entityNew("#fl.getforeign_key_type()#")>
<cfset newEntity.setName("#cd[columns][currentrow]#")>
<cfset entitySave(newEntity)>
</cfloop>
Is the syntax incorrect or is this not possible?
Thanks for your help.
Upvotes: 0
Views: 47
Reputation: 107
I figured it out. There was blank space when retrieving the name. When I used
<cfset newEntity = entityNew("#trim(fl.getforeign_key_type())#")>
it worked.
Thanks
Upvotes: 2