Skip to content

Active Record flexible batch operations(Insert,Update,Delete)#301

Open
ziaratban wants to merge 23 commits into
yiisoft:masterfrom
ziaratban:active-record-flexible-batch
Open

Active Record flexible batch operations(Insert,Update,Delete)#301
ziaratban wants to merge 23 commits into
yiisoft:masterfrom
ziaratban:active-record-flexible-batch

Conversation

@ziaratban
Copy link
Copy Markdown
Contributor

@ziaratban ziaratban commented Mar 4, 2020

Q A
Is bugfix? no
New feature? yes
Breaks BC? no
Tests pass? yes
MyActiveRecord::$batchInsertSize = 1000;
foreach($myData as $data){
    $obj = new MyActiveRecord();
    $obj->field1 = 'data1';
    $obj->field2 = 'data2';
    $obj->field3 = 'data3';
    $obj->batchSave(); #or batchInsert();
    #no any database operation execute until count of insert operation equal MyActiveRecord::$batchInsertSize
}
MyActiveRecord::flushBatchInsert(); // executing the remaining operations. required.

or batchDelete() or batchUpdate

@samdark
Copy link
Copy Markdown
Member

samdark commented Mar 4, 2020

@ziaratban tests seems to fail: https://travis-ci.com/yiisoft/yii2-mongodb/jobs/293832598

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants