CakePHP-Audit-Log-Plugin icon indicating copy to clipboard operation
CakePHP-Audit-Log-Plugin copied to clipboard

Option to ignore AuditDelta records for CREATE

Open ovedanner opened this issue 8 years ago • 2 comments

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.

ovedanner avatar Dec 22 '16 13:12 ovedanner

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

xhs345 avatar Dec 22 '16 18:12 xhs345

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

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

ravage84 avatar Dec 23 '16 15:12 ravage84