Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 23 commits into
base: master
Choose a base branch
from

Conversation

ziaratban
Copy link
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
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.

None yet

2 participants