Stats
Version
1.1
Wheels Compatibility
1.1, 1.0
Downloads
115
Last Updated
November 7, 2010
About Plugins
Plugins allow you to extend or modify default Wheels application behavior. To use, you just drop the zip file into your plugins directory and reload your application.
Read Using and Creating Plugins for more information.
Clone Model
Allows simple duplication of existing model objects and their associations.
Author
Project Home
http://github.com/andybellenie/cfwheels-clone-model
Description
This plugin allows rapid duplication of existing model objects and their associations.
Usage/Examples
New Methods
- clone([recurse=true/false])
New Callbacks
- beforeClone()
- afterClone()
Recursion
If recurse is set to true then any associated models set up as with either a hasMany() or a hasOne() association will also be cloned. If the associated model also has associations then they too will be cloned, and so on until the process encounters a model without any associations.
Usage
<cffunction name="clone">
<cfset foo = model("foo").findByKey(params.key)>
<cfset cloneOfFoo = foo.clone(recurse=true)>
</cffunction>
