Re: [cf-orm-dev] PLEASE HELP - "SET method for ORM is undefined."

75 views
Skip to first unread message

Seth Johnson

unread,
Mar 27, 2013, 1:17:40 PM3/27/13
to cf-or...@googlegroups.com

<cfset user = entityLoad("users",{userId=GetAuthUser()},false)>

Should instead be:

<cfset user = entityLoad("users",{userId=GetAuthUser()},true)>

Otherwise entityload returns an array of users and you only want one.

Seth

On Mar 27, 2013 1:11 PM, "Arish Perez" <ar...@melrish.com> wrote:
Hi,

I have started using ORM and trying convert my codes into ORM capable however i have this error.

My code is:

    <cfset user = entityLoad("users",{userId=GetAuthUser()},false)>
   
    <cfif IsNull(user) >
        <cfset errorMsg = "Incorect current password, please try again." >
    <cfelse>
        <cfset user.setPassword("#form.password#")>
        <cfset entitySave(user)>
    </cfif>


My CFC is:

<cfcomponent persistent="true" table="tblusers">
    <cfproperty name="keyColumn" generator="increment">
    <cfproperty name="userid" ormtype="string">
    <cfproperty name="password" ormtype="string">
    <cfproperty name="name" ormtype="string">
    <cfproperty name="trade" ormtype="string">
    <cfproperty name="email" ormtype="string">
    <cfproperty name="status" ormtype="string">
    <cfproperty name="role" ormtype="string">
    <cfproperty name="type" ormtype="string">
    <cfproperty name="IP" ormtype="string">
    <cfproperty name="createdBy" ormtype="integer">
    <cfproperty name="updatedAt" ormtype="date">
</cfcomponent>


The Error is:


The following information is meant for the website developer for debugging purposes.
Error Occurred While Processing Request

The setPassword method was not found.

Either there are no methods with the specified method name and argument types or the setPassword method is overloaded with argument types that ColdFusion cannot decipher reliably. ColdFusion found 0 methods that match the provided arguments. If this is a Java object and you verified that the method exists, use the javacast function to reduce ambiguity.







--
You received this message because you are subscribed to the Google Groups "cf-orm-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cf-orm-dev+...@googlegroups.com.
To post to this group, send email to cf-or...@googlegroups.com.
Visit this group at http://groups.google.com/group/cf-orm-dev?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Phill Nacelli

unread,
Mar 27, 2013, 1:32:13 PM3/27/13
to cf-or...@googlegroups.com
One more thing, 

you need to tell ColdFusion that you want the getter/setters methods generated automatically via accessors="true" in your component declaration:

<cfcomponent persistent="true" table="tblusers" accessors="true">

    <cfproperty name="keyColumn" generator="increment">
    <cfproperty name="userid" ormtype="string">
    <cfproperty name="password" ormtype="string">
    <cfproperty name="name" ormtype="string">
    <cfproperty name="trade" ormtype="string">
    <cfproperty name="email" ormtype="string">
    <cfproperty name="status" ormtype="string">
    <cfproperty name="role" ormtype="string">
    <cfproperty name="type" ormtype="string">
    <cfproperty name="IP" ormtype="string">
    <cfproperty name="createdBy" ormtype="integer">
    <cfproperty name="updatedAt" ormtype="date">
</cfcomponent>


Best,

Jason Durham

unread,
Mar 27, 2013, 1:33:11 PM3/27/13
to cf-or...@googlegroups.com
@Phil that's not actually the case if the CFC is persistent="true".  

Jason Durham


Chris Blackwell

unread,
Mar 27, 2013, 1:33:08 PM3/27/13
to cf-or...@googlegroups.com
accessors=true is not required, its implied by persistent=true

Exist~Dissolve

unread,
Mar 27, 2013, 1:35:10 PM3/27/13
to cf-or...@googlegroups.com
I thought accessors were automatically generated for persistent components.
--
You received this message because you are subscribed to the Google Groups "cf-orm-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cf-orm-dev+...@googlegroups.com.
To post to this group, send email to cf-or...@googlegroups.com.
Visit this group at http://groups.google.com/group/cf-orm-dev?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 


--
The only thing we learn from history is that we learn nothing from history.

http://singularityconcepts.com

Brian Kotek

unread,
Mar 27, 2013, 2:14:53 PM3/27/13
to cf-or...@googlegroups.com
They are.

I also hate to be "that guy", Arish, but if you would have just taken 10 seconds to do a cfdump on your user object, you would have immediately seen that you were getting an array. Next time, please attempt a minimal level of debugging before you ask others to spend time helping you.

Thanks,

Brian

Phill Nacelli

unread,
Mar 27, 2013, 2:37:12 PM3/27/13
to cf-or...@googlegroups.com, ja...@durhamcons.com
Oh wow.. Didn't know that.. 

Thought you still had to explicitly add that.. Learn something new everyday, 

thanks Jason :-)
Reply all
Reply to author
Forward
0 new messages