• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Clone of component instance

New Here ,
Nov 09, 2006 Nov 09, 2006

Copy link to clipboard

Copied

Hello Everyone,

Is there any fast and direct way to create a deep copy of component instance?
TOPICS
Advanced techniques

Views

409

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 09, 2006 Nov 09, 2006

Copy link to clipboard

Copied

1. <cfobject component="Component_Name" name="Obj_Name">

2. Obj = CreateObject("Component", "Obj_Name");
(This should be inside <script> tag)

3. <cfinvoke component = "component name or reference" method = "method name" returnVariable = "variable name" argumentCollection = "argument collection">

For more informations see the livedocs.
http://livedocs.macromedia.com/coldfusion/7/htmldocs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=C...
http://livedocs.macromedia.com/coldfusion/7/htmldocs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=C...

Thanks

Sankalan
(www.mindfiresolutions.com)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 09, 2006 Nov 09, 2006

Copy link to clipboard

Copied

None of that has anything to do with cloning a component instance though.

Can't be done in natively CF, sorry, Johnny852. The best you can do is
roll-yer-own clone() (although you'll have to call it something else, as
Java will screech if you try calling it "clone") method which creates
another instance of the same component, and then loops through the
variables and this structs and copies the values from the original into the
new one (needless to say, the cloning could end up being recursive if any
of those this/variables values are themselves CFC-instances).

It's all a bit suck, really.

--
Adam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 09, 2006 Nov 09, 2006

Copy link to clipboard

Copied





Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 09, 2006 Nov 09, 2006

Copy link to clipboard

Copied

😞

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 09, 2006 Nov 09, 2006

Copy link to clipboard

Copied

LATEST
> haha says you cameron.
> I have got quite a good ObjectCloner.cfc, but i can't upload it here :(

Which, Rhys, does exactly what I suggested.

NB: that code is (copyrighted) Straker Interactive IP. Not for public
distribution.

--
Adam
(Technical Manager, Straker Interactive, when on official duty)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation