priyank / doctrine-odm-audit
To Store New/old value as audit in database on flush event of ODM Doctrine
1.0.8
2019-04-01 16:34 UTC
Requires
README
Basic useful feature list:
- To Store New/old value as audit in database on flush event of ODM Doctrine
You need to implement IAuditHandler interface. Provide this Implemented class object as parameter of constructor.
class OdmEventManager implements IAuditHandler{ public function getPersistantRevisionObject(RevisionInfo $revisionInfo){ $revisionDoc = new RevisionDoc(); //Store revision info details into revision document //Here you can store other details like action user infromatino in Revision document return $revisionDoc; } public function getNamespaceOfDoctrineObject(){ return "Doctrine\Document"; } public function isDeleteEventAuditEnabled() { return true; } public function isInsertEventAuditEnabled() { return true; } public function isRequireToStoreAudit($obj) { return ($obj instanceof UserDocument); } public function isUpdateEventAuditEnabled() { return true; } public function isUpsertEventAuditEnabled() { return true; }
$odmAuditEventManager = new OdmAuditEventManager(new OdmEventManager()); $eventManager = new EventManager(); $eventManager->addEventListener([Events::onFlush], $odmAuditEventManager);