Super classes that allow an audit trail to be built automatically for subclasses + nested transactions
This extension will allow models to be backed up by an audit trail.
It also creates the functionality of nested transactions (MySQL tested).
- Extract the release file under
protected/extensions (usually I use components, but extensions should be fine)
- File list:
AuditedCActiveRecord --- extend from this class if you want the subclass to be backed by the audit trail
AuditTrail --- the model describing the audit trail table
AuditTrailSequenceNumber --- the model describing the audit trail sequence table
CustomCActiveRecord --- the base class for all models
NestedCDbConnection --- creates/supports nested transactions
NestedTransactionPDO --- creates/supports nested transactions
- Modify config/main.php -> db array to use class=>NestedCDbConnection
- Import audit_schema.sql (MySQL)
For the required model, extend from AuditedCActiveRecord.
Save/delete as per normal.
If transactions are desired, use transactedSave/transactedDelete.
Classes which want to use transatedSave/transactedDelete must extend from CustomCActiveRecord.
Read the comments in the classes for more information!
Change Log ¶
July 1, 2010 ¶