Monday, December 5, 2011

cakephp revisionable behavior

Not sure if anyone else has been looking for this like me, but I
created an easy to use simple versionable behavior for cakephp 1.3 it
hooks into the beforeSave callback and grabs a copy of the data before
it changes and stores it in a revsions table. The great thing about
this plugin is that you don't need to make a different shadow table
for each model. All models can be placed into the same table.

I've thrown together a quick article on it in the bakery
http://bakery.cakephp.org/articles/analogrithems/2011/12/06/simple_revisionable_behavior_with_cakephp_1_3

Code is available at https://github.com/analogrithems/revisionable

The install is super simple two steps
1) First you need to add the table to your project use the following
to generate that
cake schema create Revisionable.revision

2) add the behavior to your model like so

var $actAs = array('Revisionable.Revisionable');


I'd love feedback on this if anyone sees fit.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: