dutchakdev / yii-batch
Installs: 17
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 0
pkg:composer/dutchakdev/yii-batch
Requires
- php: >=5.5.12
- yiisoft/yii: @dev
Requires (Dev)
- phpunit/dbunit: >=1.2
- phpunit/php-invoker: *
- phpunit/phpunit: 3.7.*
- phpunit/phpunit-selenium: >=1.2
- phpunit/phpunit-story: *
This package is not auto-updated.
Last update: 2025-10-07 07:09:37 UTC
README
Same "batch" of yii2, but Simplified. Just for fun
Batch is helper-iterator for yii created for batch processing.
yii-batch / protected / components / Batch.php
// Usage batch:
$criteria = new \CDbCriteria();
$criteria->limit = 1000;
// Get 100 records per object
foreach((new \Batch(100, Models\Heisenberg::model()->with('Jesse'))->findAll($criteria) as $meth){
// 100 objects in $meth, 10 query to db
}
// Usage each:
$criteria = new \CDbCriteria();
$criteria->limit = 1000;
// Get 100 records per object
foreach((new \Batch(100, Models\Heisenberg::model()->with('Jesse'), true)->findAll($criteria) as $meth){
// 1 object in $meth, 10 query to db
}
Instalation
From composer:
Add to your composer.json
"require": { ... "dutchakdev/yii-batch": "@dev" }
Run command
$ composer update
From git/zip:
$ git clone git@github.com:dutchakdev/yii-batch.git ./path_to_exstensions/
Add to yor config
'import'=>array( ... 'path_to_vendor.dutchakdev.yii-batch.Batch' ),