yii2mod/yii2-data-sync-behavior
最新稳定版本:1.3
Composer 安装命令:
composer require yii2mod/yii2-data-sync-behavior
包简介
Behavior for export data to local files from database tables. Changes are tracked using model events.
关键字:
README 文档
README
Behavior for export data to local files from database tables. Changes are tracked using model events.
[](https://packagist.org/packages
/yii2mod/yii2-data-sync-behavior)
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist yii2mod/yii2-data-sync-behavior "*"
or add
"yii2mod/yii2-data-sync-behavior": "*"
to the require section of your composer.json file.
Recording changes
Attach the behavior to the model:
use yii2mod\datasync\DataSyncBehavior; public function behaviors() { return [ 'dataSync' => [ 'class' => DataSyncBehavior::className(), // `folderPath` property maybe need to change. 'folderPath' => '@app/config/data' ], ]; }
- After model events(AFTER_UPDATE, AFTER_INSERT, AFTER_DELETE) behavior will be automatically create files in default path(@app/config/data) with data from this model.
- Files will be created in json format.
Import changes
- Add
datasynccommand to console config:
'controllerMap' => [
'datasync' => [
'class' => 'yii2mod\datasync\commands\DataSyncCommand',
// `folderPath` property maybe need to change.
'folderPath' => '@app/config/data'
],
],
-
Execute command from console. For example:
php yii datasync - synchronize data for all files php yii datasync/index --table=User - synchronize data only for `User` table
统计信息
- 总下载量: 135
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-08-31