Re: Instance scope

View: New views
8 Messages — Rating Filter:   Alert me  

Re: Instance scope

by jason.r.cronk :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

You're on the right track.  Instead of calling member.lname and
member.fname you'll be calling the functions member.getlname() or
member.getfname().  That helps preserve encapsulation.


If you want to return everything then use something like getAttributes that
return a structure.

<invoke class="member" methodcall="get(url.memberid)"
returnVariable="member" />
<set name="fieldname" value="member.getAttributes()">

Then you can reference each field as fieldname.lname and fieldname.fname.


Jason Cronk
jason.r.cronk@...




                                                                                                                                       
                      "Mark Kecko"                                                                                                    
                      <mark@...        To:       "Fusebox" <fusebox@...>                                        
                      om>                      cc:                                                                                    
                                               Subject:  Re: Instance scope                                                            
                      04/15/2005 02:39                                                                                                
                      PM                                                                                                              
                      Please respond to                                                                                                
                      fusebox                                                                                                          
                                                                                                                                       
                                                                                                                                       




So I changed all of my instance variables inside my component to the
variables scope.  After I did this everything seemed to work fine until
I tried to reference my member object.  I'm calling the object with
invoke in my FB4.1 circuit file like:

<invoke class="member" methodcall="get(url.memberid)"
returnVariable="member" />

I used to reference my object on my dsp pages like member.fname and
member.lname (when I was using the instance scope) but now that doesn't
work anymore.  I get fname is undefined in member.

I'm guessing with my current component setup that I'll have to create a
controller cfc or have a function in my member.cfc like getName and then
say member.getname() on my dsp page to display the persons name.  Am I
on the right track or am I missing something entirely?


Member.cfc component full listing---------------------------------------
<cfcomponent displayname="Member Entity">

             <cffunction name="init" access="public" output="false"
returntype="membermanager.model.member">
                         <cfargument name="aid" type="numeric" default="0">

                         <cfset var member_select = 0/>

                         <cfset var member_last_update = 0/>

                         <cfscript>
                         variables.aid = arguments.aid;

                         variables.fname = "";
                         variables.lname = "";

                         variables.company = "";
                         </cfscript>

                         <cfif variables.aid neq 0>
                                     <cfquery name="member_select"
maxrows="1" datasource="mp2">
                                     select *
                                     from members
                                     where m_aid = <cfqueryparam
value="#arguments.aid#"
cfsqltype="cf_sql_integer">
                                     </cfquery>

                                     <cfif member_select.recordcount eq 1>
                                                 <cfscript>
                                                 variables.aid =
member_select.m_aid;


                                                 variables.fname =
member_select.m_fname;
                                                 variables.lname =
member_select.m_lname;

                                                 variables.company =
member_select.m_company;
                                                 </cfscript>

                                     </cfif>
                         </cfif>

                         <cfreturn this>
             </cffunction>

             <cffunction name="get" access="public" output="false"
returntype="membermanager.model.member">
                         <cfargument name="aid" type="numeric"
required="true">
                         <cfset init(arguments.aid)>
                         <cfreturn this>
             </cffunction>
</cfcomponent>

Mark Kecko
Technology Director
MediaPost Communications
mark@...
212-204-2002



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:12:6764
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/12
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:12
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.12
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Re: Instance scope

by Brian Kotek :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Jason you just responded to message that was posted over two months ago. ;-)

On 6/17/05, jason.r.cronk@... <jason.r.cronk@...> wrote:

>
> You're on the right track. Instead of calling member.lname and
> member.fname you'll be calling the functions member.getlname() or
> member.getfname(). That helps preserve encapsulation.
>
>
> If you want to return everything then use something like getAttributes
> that
> return a structure.
>
> <invoke class="member" methodcall="get(url.memberid)"
> returnVariable="member" />
> <set name="fieldname" value="member.getAttributes()">
>
> Then you can reference each field as fieldname.lname and fieldname.fname.
>
>
> Jason Cronk
> jason.r.cronk@...
>
>
>
>
>
> "Mark Kecko"
> <mark@... To: "Fusebox" <fusebox@...>
> om> cc:
> Subject: Re: Instance scope
> 04/15/2005 02:39
> PM
> Please respond to
> fusebox
>
>
>
>
>


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:12:6765
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/12
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:12
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.12
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Parent Message unknown Re: Instance scope

by jason.r.cronk :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm slow!!  No, actually I wasn't paying attention, just going through my
new mail, hitting delete or responding.  My mail must have pulled up the
message and I just assumed it was new. DOH!

Jason Cronk
jason.r.cronk@...



                                                                                                                                       
                      "Brian Kotek"                                                                                                    
                      <brian428@...        To:       "Fusebox" <fusebox@...>                                        
                      om>                      cc:                                                                                    
                                               Subject:  Re: Instance scope                                                            
                      06/17/2005 05:26                                                                                                
                      PM                                                                                                              
                      Please respond to                                                                                                
                      fusebox                                                                                                          
                                                                                                                                       
                                                                                                                                       




Jason you just responded to message that was posted over two months ago.
;-)






~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:12:6766
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/12
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:12
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.12
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Re: Instance scope

by Mark Kecko :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Your response is appreciated, despite its timing!

Mark Kecko
Technology Director
MediaPost Communications
mark@...
212-204-2002

jason.r.cronk@... wrote:

> I'm slow!!  No, actually I wasn't paying attention, just going through my
> new mail, hitting delete or responding.  My mail must have pulled up the
> message and I just assumed it was new. DOH!
>
> Jason Cronk
> jason.r.cronk@...
>
>
>
>                                                                                                                                        
>                       "Brian Kotek"                                                                                                    
>                       <brian428@...        To:       "Fusebox" <fusebox@...>                                        
>                       om>                      cc:                                                                                    
>                                                Subject:  Re: Instance scope                                                            
>                       06/17/2005 05:26                                                                                                
>                       PM                                                                                                              
>                       Please respond to                                                                                                
>                       fusebox                                                                                                          
>                                                                                                                                        
>                                                                                                                                        
>
>
>
>
> Jason you just responded to message that was posted over two months ago.
> ;-)
>
>
>
>
>
>
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Stay Ahead of Hackers - Download ZoneAlarm Pro
http://www.houseoffusion.com/banners/view.cfm?bannerid=65

Message: http://www.houseoffusion.com/lists.cfm/link=i:12:6767
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/12
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:12
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.12
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

RE: Instance scope

by gabriel l smallman :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey guys, this just sparked a thought. Does the fusebox parser support
something like this for passing in arguments:

<invoke class="member" methodcall="get()"
        returnVariable="member" />
        <argument name="memberid" value="#url.memberid#">
</invoke>

thanks

gabe

-----Original Message-----
From: Brian Kotek [mailto:brian428@...]
Sent: Friday, June 17, 2005 5:26 PM
To: Fusebox
Subject: Re: Instance scope

Jason you just responded to message that was posted over two months ago. ;-)

On 6/17/05, jason.r.cronk@... <jason.r.cronk@...> wrote:

>
> You're on the right track. Instead of calling member.lname and
> member.fname you'll be calling the functions member.getlname() or
> member.getfname(). That helps preserve encapsulation.
>
>
> If you want to return everything then use something like getAttributes
> that return a structure.
>
> <invoke class="member" methodcall="get(url.memberid)"
> returnVariable="member" />
> <set name="fieldname" value="member.getAttributes()">
>
> Then you can reference each field as fieldname.lname and fieldname.fname.
>
>
> Jason Cronk
> jason.r.cronk@...
>
>
>
>
>
> "Mark Kecko"
> <mark@... To: "Fusebox" <fusebox@...>
> om> cc:
> Subject: Re: Instance scope
> 04/15/2005 02:39
> PM
> Please respond to
> fusebox
>
>
>
>
>




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:12:6768
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/12
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:12
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.12
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Re: Instance scope

by Sean Corfield :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 6/18/05, gabriel l smallman <gabe@...> wrote:
> Hey guys, this just sparked a thought. Does the fusebox parser support
> something like this for passing in arguments:

No. And I don't see a need for it. You can specify named arguments
directly if you need to:

<invoke class="member" methodcall="get(memberid=url.memberid)"
returnVariable="member" />

BTW, in your code, you are closing the <invoke> verb before the
<argument> verb anyway which is illegal syntax:
> <invoke class="member" methodcall="get()"
>         returnVariable="member" />
>         <argument name="memberid" value="#url.memberid#">
> </invoke>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how to get a fax number that sends and receives faxes using your current email address
http://www.houseoffusion.com/banners/view.cfm?bannerid=64

Message: http://www.houseoffusion.com/lists.cfm/link=i:12:6769
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/12
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:12
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.12
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

RE: Instance scope

by gabriel l smallman :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Shoot,

I find it hard to read if you have a ton of arugments to pass in. Oh well.
thanks for feedback.

gabe

-----Original Message-----
From: Sean Corfield [mailto:seancorfield@...]
Sent: Saturday, June 18, 2005 4:48 PM
To: Fusebox
Subject: Re: Instance scope

On 6/18/05, gabriel l smallman <gabe@...> wrote:
> Hey guys, this just sparked a thought. Does the fusebox parser support
> something like this for passing in arguments:

No. And I don't see a need for it. You can specify named arguments directly
if you need to:

<invoke class="member" methodcall="get(memberid=url.memberid)"
returnVariable="member" />

BTW, in your code, you are closing the <invoke> verb before the <argument>
verb anyway which is illegal syntax:
> <invoke class="member" methodcall="get()"
>         returnVariable="member" />
>         <argument name="memberid" value="#url.memberid#"> </invoke>



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:12:6770
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/12
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:12
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.12
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Re: Instance scope

by Sean Corfield :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 6/20/05, gabriel l smallman <gabe@...> wrote:
> I find it hard to read if you have a ton of arugments to pass in. Oh well.
> thanks for feedback.

Maybe your function is doing too much then?

Long argument lists are not good practice (because, as you note, they
can be hard to read and therefore hard to maintain).
--
Sean A Corfield -- http://corfield.org/
Team Fusebox -- http://fusebox.org/
Got Gmail? -- I have 50, yes 50, invites to give away!

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:12:6771
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/12
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:12
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.12
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54