| Recommend this page to a friend! |
| Info | Documentation | Reputation | Support forum | Blog | Links |
| Ratings | Unique User Downloads | Download Rankings | ||||
| Not yet rated by the users | Total: 18 | All time: 11,390 This week: 455 | ||||
| Version | License | PHP version | Categories | |||
| yii2-arsync 1.0 | MIT/X Consortium ... | 5 | PHP 5, Databases, Design Patterns |
This behavior for automatic or manual sync data between two models, without declaration relation. This behavior must be attached on master model. Main purposes - for sync rarely modified data from more reliable database storage to redis storage for frequently access; Support actual data state in some development cases;
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist insolita/yii2-arsync "*"
or add
"insolita/yii2-arsync": "*"
to the require section of your composer.json file.
Once the extension is installed, simply use it in your code by : See more in code
public function behaviors(){
return [
'ArSyncBehavior'=>[
'class' => ArSyncBehavior::class,
'slaveModel' => \your\model\namespase\Slave::className(),
'slaveScenario'=>'sync',
'errorSaveCallback'=>function($slave){
Yii::error(VarDumper::export($slave->errors));
throw new InvalidConfigException('fail save ');
},
'errorDeleteCallback'=>function($slave){
Yii::error('fail delete '.$slave->getPrimaryKey());
},
'fieldMap' => [
'id'=>'id',
'title' => 'name',
'foo' => 'foo',
'bar' => 'bar',
'baz' => function($master)
{
return $master->baz * 2;
},
],
]
];
}
| File | Role | Description | ||
|---|---|---|---|---|
| Class | Class source | |||
| Data | Auxiliary data | |||
| Doc. | Documentation | |||
| / | tests | / | codeception | / | common |
| File | Role | Description | ||
|---|---|---|---|---|
| |
Class | Class source | ||
| / | tests | / | codeception | / | common | / | migrations |
| File | Role | Description |
|---|---|---|
| |
Class | Class source |
| / | tests | / | codeception | / | common | / | unit |
| File | Role | Description | ||
|---|---|---|---|---|
| |
Class | Class source | ||
| / | tests | / | codeception | / | common | / | unit | / | behaviors |
| File | Role | Description |
|---|---|---|
| |
Class | Class source |
| / | tests | / | codeception | / | common | / | unit | / | fixtures |
| File | Role | Description |
|---|---|---|
| |
Class | Class source |
| |
Class | Class source |
| |
Class | Class source |
| |
Class | Class source |
| The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
| Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
| 100% |
|
|
| Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.