PHP code example of ezoterik / yii2-project-assist
1. Go to this page and download the library: Download ezoterik/yii2-project-assist library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ezoterik / yii2-project-assist example snippets
$query = Model::find()->orderBy('id');
BatchIteratorHelper::processEach($query, function (Model $model, int &$updatedCounter) {
//TODO: Do something with $model here...
++$updatedCounter;
});
$query = Model::find()->orderBy('id');
BatchIteratorHelper::processBatch($query, function (array $users, int &$updatedCounter) {
//TODO: Do something with $users here...
$updatedCounter += count($users);
});