Re: [cfaussie] CreateObject of itself

2011-07-13 Thread Phil Haeusler

Hi Steve

If you're just trying to avoid referencing the component name within 
itself, then why not try using


local.metaData = GetMetaData(this);
local.tmpObj = CreateObject(component, local.metaData.fullname).init();

You might want to check the docs to see if fullname is the correct key 
to reference, but this sort of idea should allow you to create an 
instance of the CFC you're currently in.


Phil


On 13/07/11 8:37 PM, Steve Onnis wrote:


Can anyone suggest a way i can create a new reference to a cfc that i 
am already in?


Something like

FooBar.cfc

cfcomponent

cfproperty name=fooProp type=string /

cffunction name=bar output=false

cfscript

  LOCAL.tmpArr = [];

*for* (LOCAL.i = 1; LOCAL.i LTE 10; LOCAL.i = LOCAL.1+1) {

LOCAL.tmpObj = *new* this_;_

LOCAL.tmpObj.setfooBar(Some String #LOCAL.i#);

*ArrayAppend*(LOCAL.tmpArr, LOCAL.tmpObj);

}

/cfscript

/cffunction

/cfcomponent

Obviously new this; wont work.

I want something to replace

LOCAL.tmpObj = *createObject*(COMPONENT, FooBar);

Ideas?

Steve

--
You received this message because you are subscribed to the Google 
Groups cfaussie group.

To post to this group, send email to cfaussie@googlegroups.com.
To unsubscribe from this group, send email to 
cfaussie+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en.


--
You received this message because you are subscribed to the Google Groups 
cfaussie group.
To post to this group, send email to cfaussie@googlegroups.com.
To unsubscribe from this group, send email to 
cfaussie+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en.



Re: [cfaussie] CreateObject of itself

2011-07-13 Thread Dennis Clark
Duplicate works on CFC instances, so Duplicate(this) would work. Of course
it also duplicates the state of the instances variables in 'this', so it
might not be what you want.

Otherwise, try CreateObject(component,GetMetaData(this).name) or
maybe CreateObject(component,GetMetaData(this).fullname). I'm not sure
which is better.

-- Dennis

On 13 July 2011 20:37, Steve Onnis st...@cfcentral.com.au wrote:

 Can anyone suggest a way i can create a new reference to a cfc that i am
 already in?

 ** **

 Something like

 ** **

 FooBar.cfc

 cfcomponent

   cfproperty name=fooProp type=string /

   cffunction name=bar output=false

 cfscript

   LOCAL.tmpArr = [];

   *for* (LOCAL.i = 1; LOCAL.i LTE 10; LOCAL.i = LOCAL.1+1)
 {

 LOCAL.tmpObj = *new* this*;*

 LOCAL.tmpObj.setfooBar(Some String #LOCAL.i#);**
 **

 *ArrayAppend*(LOCAL.tmpArr, LOCAL.tmpObj);

 }

 /cfscript

   /cffunction

 /cfcomponent

 ** **

 Obviously “new this;” wont work.

 ** **

 I want something to replace 

 LOCAL.tmpObj = *createObject*(COMPONENT, FooBar);

 ** **

 Ideas?

 ** **

 Steve

 --
 You received this message because you are subscribed to the Google Groups
 cfaussie group.
 To post to this group, send email to cfaussie@googlegroups.com.
 To unsubscribe from this group, send email to
 cfaussie+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/cfaussie?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
cfaussie group.
To post to this group, send email to cfaussie@googlegroups.com.
To unsubscribe from this group, send email to 
cfaussie+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en.



RE: [cfaussie] CreateObject of itself

2011-07-13 Thread Steve Onnis
An you do something like 

new init()

?

 

From: Dennis Clark [mailto:boomf...@gmail.com] 
Sent: Wednesday, 13 July 2011 8:58 PM
To: cfaussie@googlegroups.com
Subject: Re: [cfaussie] CreateObject of itself

 

Duplicate works on CFC instances, so Duplicate(this) would work. Of course
it also duplicates the state of the instances variables in 'this', so it
might not be what you want.

 

Otherwise, try CreateObject(component,GetMetaData(this).name) or maybe
CreateObject(component,GetMetaData(this).fullname). I'm not sure which is
better.

 

-- Dennis

On 13 July 2011 20:37, Steve Onnis st...@cfcentral.com.au wrote:

Can anyone suggest a way i can create a new reference to a cfc that i am
already in?

 

Something like

 

FooBar.cfc

cfcomponent

  cfproperty name=fooProp type=string /

  cffunction name=bar output=false

cfscript

  LOCAL.tmpArr = [];

  for (LOCAL.i = 1; LOCAL.i LTE 10; LOCAL.i = LOCAL.1+1) {

LOCAL.tmpObj = new this;

LOCAL.tmpObj.setfooBar(Some String #LOCAL.i#);

ArrayAppend(LOCAL.tmpArr, LOCAL.tmpObj);

}

/cfscript

  /cffunction

/cfcomponent

 

Obviously new this; wont work.

 

I want something to replace 

LOCAL.tmpObj = createObject(COMPONENT, FooBar);

 

Ideas?

 

Steve

-- 
You received this message because you are subscribed to the Google Groups
cfaussie group.
To post to this group, send email to cfaussie@googlegroups.com.
To unsubscribe from this group, send email to
cfaussie+unsubscr...@googlegroups.com
mailto:cfaussie%2bunsubscr...@googlegroups.com .
For more options, visit this group at
http://groups.google.com/group/cfaussie?hl=en.

 

-- 
You received this message because you are subscribed to the Google Groups
cfaussie group.
To post to this group, send email to cfaussie@googlegroups.com.
To unsubscribe from this group, send email to
cfaussie+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/cfaussie?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
cfaussie group.
To post to this group, send email to cfaussie@googlegroups.com.
To unsubscribe from this group, send email to 
cfaussie+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en.