Download Plugin (zip)

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

Andy Bellenie

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>

Change Log

Version 1.1—November 7, 2010 Download

Updated for Wheels 1.1
Wheels compatibility: 1.0, 1.1.

Version 1.0—March 22, 2010 Download

  • Initial release.
  • Wheels compatibility: 1.0, 1.0.1, 1.0.2.