Download the PHP package olegf13/yii2-mongorevision-behavior without Composer
On this page you can find all versions of the php package olegf13/yii2-mongorevision-behavior. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download olegf13/yii2-mongorevision-behavior
More information about olegf13/yii2-mongorevision-behavior
Files in olegf13/yii2-mongorevision-behavior
Package yii2-mongorevision-behavior
Short Description MongoRevision behavior for Yii 2
License MIT
Homepage https://github.com/olegf13/yii2-mongorevision-behavior
Informations about the package yii2-mongorevision-behavior
MongoRevision behavior for Yii 2
This behavior provides automatic revision creation of any ActiveRecord object(s) into MongoDB collection.
It means, that the extension will automatically save "previous version" of your ActiveRecord object after it's been updated.
So you can store and track the history of all your data changes.
To describe in detail, MongoRevision behavior will collect "old" AR object attributes, fill the revisionOwnerId
,
revisionOwnerModel
, revisionDate
and revisionUser
attributes with the corresponding values;
and then store the resulting AR object revision in particular MongoDB revision
collection.
Behavior is called after the associated AR object is being updated (EVENT_AFTER_UPDATE).
Installation
This extension requires MongoDb Extension for Yii 2.
The preferred way to install this extension is through composer.
Either run
or add
to the require section of your composer.json
file.
Usage
To use MongoRevisionBehavior, insert the following code to your ActiveRecord class:
If your MongoDB connection name is different or you want to use a different collection or attribute names, you may configure behavior properties like the following: