1

I implemented the Loggable extensions of Doctrine. But now I have the following case. I want to track "status" of object. But the objects already exist in my db with corresponding status for each of them. When I update one, in the log_entry is inserted the first log for an object with the new value for its status. (Let say I chnage status from active to suspended and in the log entry is inserted suspended)

From this moment I cannot revert the "active" status, becouse it is not recorded nowhere. I can deal with that with several ways, but is there some option for that Loggable Extension that instead of inserting new version, as a lest record for object in logs to store the current version, before changes happen?

Ivo
  • 353
  • 2
  • 13

1 Answers1

1

You can override getObjectChangeSetData from LoggableListener.

Old values are stored there in $changes array.

Maciek W.
  • 114
  • 1
  • 6
  • 1
    I did something other. An update listener who is checking is this entry will be first record or not. If it is, I insert one record before Loggable listener to insert his first record with the new value – Ivo Jan 23 '17 at 07:02