I tried to use the other revision behavior, my biggest complaint is
the requirement for an additional shadow table for each model you want
to backup.  Also I tried to get it to work for a while and it seemed
broken.  The last version I had seen was in the bakery, I just noticed
that it had been updated and moved to github.  I haven't tried his
newest version.


The solution I created kept it simple and just set recursive to 1 and
took a copy of the data before it saved via the beforeSave callback
and serialized the data to a longblob field

I updated it today with your code recommendations as well as.  The
behavior works for me in a simple cms to be able to see the previous
versions and roll them back.

-Aaron
On Tue, Dec 6, 2011 at 2:30 AM, euromark <[email protected]> wrote:
> From a glance I see only 2 code flaws:
> "private" declarations shouldnt be used inside a framework without
> very good reason to do so (use "protected" instead)
> ->Save should probably be ->save
>
> and it would probably be a good idea to make a test case for it.
> especially since revisions and everything related to it is an
> important task :)
> and you or others might want to enhance the code some day.
> without the regression tests that will be difficult to accomplish.
>
> PS: what didnt you like about the existing behavior?
> http://code.google.com/p/alkemann/downloads/list
> seems like it is already quite sophisticated (although slightly
> outdated, maybe - 2009).
> it seems to have solved the diff part, as well.
>
> cheers
> mark
>
>
> On 6 Dez., 08:08, Jeremy Burns | Class Outfit
> <[email protected]> wrote:
>> I like the principle, but how does it work in practice? A few questions:
>>
>> - I haven't looked at the code, but my guess is that you are storing an 
>> array?
>> - You also mention that it stores related data. So does this mean that if a 
>> table can be updated from two places - one with a save and the other with a 
>> saveAll - that the array it stores in each case is different?
>> - How do you get the data back out and into the database - or is the purpose 
>> something other than rolling back?
>> - How do you parse the rows to get an understanding of what's happened?
>> - How do you find the revision you are looking for (say something changed 
>> about a week ago and you want to find out what happened and who did it?).
>> - If you apply this to lots of tables it's going to become huge, isn't it?
>>
>> Jeremy Burns
>> Class Outfit
>>
>> http://www.classoutfit.com
>>
>> On 6 Dec 2011, at 06:5632, anagrithems wrote:
>>
>>
>>
>>
>>
>>
>>
>> > 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_re...
>>
>> > Code is available athttps://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 
>> > Tutorialshttp://tv.cakephp.org
>> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help 
>> > others with their CakePHP related questions.
>>
>> > To unsubscribe from this group, send email to
>> > [email protected] For more options, visit this group 
>> > athttp://groups.google.com/group/cake-php
>
> --
> 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
> [email protected] For more options, visit this group at 
> http://groups.google.com/group/cake-php

-- 
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
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to