Skip to content
This repository was archived by the owner on Jun 14, 2023. It is now read-only.

Revisionablebehavior

joncutrer edited this page Feb 29, 2012 · 4 revisions

is part of ProUtils plugin for CakePHP 2

Currently under developement!, RevisionableBehavior is not aware of multi record inserts, consider it unstable for now.

Example Usage

public $actsAs = array( 'ProUtils.Revisionable' );

You will need to create an adjacent Model and table to use this behavior. So if you wanted to track revision changes to the Model User, create the Model UserRevision and the table user_revisions. The user_revisions table should contain a user_id column and for performance this column should be indexed. Another example, for Model Post, create the Model PostRevision and the table post_revisions with the int column post_id (indexed).

Planned features for Revisionable

  • Finder method(s) for getting at the revisions data
  • Rollback method(s) to revert current record to an older revision
  • Diff method(s) to compare revisions
  • Revision limit, keep x number of past revisions, keep revisions less than x days old
  • Save fields, the option to only copy certain columns into revisions
  • Trigger fields, only make a revision if certain fields are changed
  • CakePHP 2.1 event dispatchers so that other plugins can hook this Behavior

RevisionableBehavior is part of ProUtils plugin for CakePHP 2

Clone this wiki locally