Upgrade CakePHP 2.x app to 4.x

Hi everyone!

I’m currently planning to upgrade a CakePHP 2.x app to version 4.x, app tracks membership details for a not-for-profit group. I’ve starting going through the book and the CMS tutorial so have a grasp on it - liking the new features, ORM etc. New authentication and authorisation looks impressive.

There are a few things we need to implement for auditing etc

  • Record who created and changed a field - we used to have the “WhoDidIt” behaviour in 2.x which updated “created_by” and “modified_by” fields in each table but I see that is no upgraded for 4.x
  • Log all actions using the “Logable” behaviour - I see this also hasn’t been upgraded for 4.x

Both these are in Cakephp-tools.

I imagine these sort of features would be important in any record management app so my questions are;

  1. Is there a better way to implement “WhoDidIt” type behaviour now with 4.x, or should I look at upgrading this behaviour if its needed?

  2. Is there a better way to log user actions?

With the logging, we’ve set it up so we can go to a record and see all actions against a particular record and who did them, or go to a user record and see all actions they’ve done against all records - handy for troubleshooting, people mangling records etc.

Thanks in advance for any help!

Regards,
Brian

I use GitHub - UseMuffin/Footprint: CakePHP plugin to allow passing currently logged in user to model layer. for the “who did it” part.

1 Like

For logging user actions checkout GitHub - lorenzo/audit-stash: Flexible and rock solid audit log tracking for CakePHP 3

Thanks - I’ve checked it out on the CMS tutorial and worked as needed :slight_smile:

I managed to miss this one on the CakePHP Awesome page too - should have my glasses on :stuck_out_tongue:

Thanks - will check this out too

Had it up and running in minutes on the CMS tutorial - nice. Could almost say… piece of cake?

Another problem solved