robwilkerson / CakePHP-Audit-Log-Plugin

Records changes made to an object during CRUD operations.
104 stars 78 forks source link

Option to ignore AuditDelta records for CREATE #112

Open ovedanner opened 7 years ago

ovedanner commented 7 years ago

Hi,

First off, I really the way this plugin is setup and how it deals with logging. Is it an idea to be able to ignore the creation of AuditDelta records when a resource is created? A full snapshot is already created as an Audit record and setting all values for the first time can lead to the creation of a lot of AuditDelta records.

xhs345 commented 7 years ago

Hi,

there is currently no option to disable inserting records to AuditDelta on Create, but it should be an easy change. I guess the best way to make the check is to create a new setting option (e.g. saveDeltaOnCreate .. maybe you have a better idea) and then make some changes around these lines: https://github.com/robwilkerson/CakePHP-Audit-Log-Plugin/blob/master/Model/Behavior/AuditableBehavior.php#L211

I'm still working on a few other updates, so if you want that feature it would be the easiest if you could work on it and send a PR

ravage84 commented 7 years ago

It could be a configuration setting like Validation's on key:

http://book.cakephp.org/2.0/en/models/data-validation.html#on