src/Shell/PurifierShell.php
protected function _process(Table $table, $chunkCount, $chunkSize, $fields) {
        $query = $table->find();
        if ($table->hasFinder('purifier')) {
            $query->find('purifier');
        }

        $fields[] = $table->primaryKey();

        $results = $query
            ->select($fields)
            ->offset($chunkCount)
            ->limit($chunkSize)
            ->orderDesc($table->aliasField($table->primaryKey()))
            ->all();

        if (empty($results)) {
            return;
        }

        foreach ($results as $result) {
            try {
                $table->save($result);
                $chunkCount++;
            } catch (\Exception $e) {
                $this->abort($e->getMessage());
            }
        }
    }
protected function _process(Table $table, $chunkCount, $chunkSize, $fields) {
        $query = $table->find();
        if ($table->hasFinder('purifier')) {
            $query->find('purifier');
        }

        $fields[] = $table->primaryKey();

        $results = $query
            ->select($fields)
            ->offset($chunkCount)
            ->limit($chunkSize)
            ->orderDesc($table->aliasField($table->primaryKey()))
            ->all();

        if (empty($results)) {
            return;
        }

        foreach ($results as $result) {
            try {
                $table->save($result);
                $chunkCount++;
            } catch (\Exception $e) {
                $this->abort($e->getMessage());
            }
        }
    }
protected function _process ( Table $ table , $ chunkCount , $ chunkSize , $ fields ) { $ query = $ table -> find ( ) ; if ( $ table -> hasFinder ( 'purifier' ) ) { $ query -> find ( 'purifier' ) ; } $ fields [ ] = $ table -> primaryKey ( ) ; $ results = $ query -> select ( $ fields ) -> offset ( $ chunkCount ) -> limit ( $ chunkSize ) -> orderDesc ( $ table -> aliasField ( $ table -> primaryKey ( ) ) ) -> all ( ) ; if ( empty ( $ results ) ) { return ; } foreach ( $ results as $ result ) { try { $ table -> save ( $ result ) ; $ chunkCount ++ ; } catch ( \ Exception $ e ) { $ this -> abort ( $ e -> getMessage ( ) ) ; } } }
Processes the records.

@param \Cake\ORM\Table $table
@param int $chunkCount
@param int $chunkSize
@return void
Processes the records .