2017 © Pedro Peláez
 

yii2-extension yii2-mongorevision-behavior

MongoRevision behavior for Yii 2

image

olegf13/yii2-mongorevision-behavior

MongoRevision behavior for Yii 2

  • Friday, July 8, 2016
  • by Olegf13
  • Repository
  • 1 Watchers
  • 0 Stars
  • 15 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

MongoRevision behavior for Yii 2

This behavior provides automatic revision creation of any ActiveRecord object(s) into MongoDB collection., (*1)

It means, that the extension will automatically save "previous version" of your ActiveRecord object after it's been updated., (*2)

So you can store and track the history of all your data changes., (*3)

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., (*4)

Behavior is called after the associated AR object is being updated (EVENT_AFTER_UPDATE)., (*5)

Installation

This extension requires MongoDb Extension for Yii 2., (*6)

The preferred way to install this extension is through composer., (*7)

Either run, (*8)

php composer.phar require --prefer-dist olegf13/yii2-mongorevision-behavior "*"

or add, (*9)

"olegf13/yii2-mongorevision-behavior": "*"

to the require section of your composer.json file., (*10)

Usage

To use MongoRevisionBehavior, insert the following code to your ActiveRecord class:, (*11)

use olegf13\mongorevision\MongoRevisionBehavior;
// ...
public function behaviors()
{
    return [
        MongoRevisionBehavior::className(),
    ];
}

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:, (*12)

use olegf13\mongorevision\MongoRevisionBehavior;
// ...
public function behaviors()
{
    return [
        [
            'class' => MongoRevisionBehavior::className(),
            'mongoConnectionName' => 'mongodb',
            'mongoCollection' => 'revision',
            'revisionOwnerIdAttribute' => 'ownerId',
            'revisionOwnerModelAttribute' => 'ownerModel',
            'revisionDateAttribute' => 'revisionDate',
            'revisionUserAttribute' => 'revisionUser',
        ],
    ];
}

The Versions

08/07 2016

dev-master

9999999-dev https://github.com/olegf13/yii2-mongorevision-behavior

MongoRevision behavior for Yii 2

  Sources   Download

MIT

The Requires

 

mongodb extension yii2 behavior mongo vcs revision versioning

08/07 2016

0.2.0

0.2.0.0 https://github.com/olegf13/yii2-mongorevision-behavior

MongoRevision behavior for Yii 2

  Sources   Download

MIT

The Requires

 

mongodb extension yii2 behavior mongo vcs revision versioning

04/02 2016

0.1.0

0.1.0.0 https://github.com/olegf13/yii2-mongorevision-behavior

MongoRevision behavior for Yii 2

  Sources   Download

MIT

The Requires

 

mongodb extension yii2 behavior mongo vcs revision versioning