src/Shell/ImportShell.php
protected function _existingImport(ImportsTable $table, Import $import, int $count) : bool
    {
        $result = false;

        $data = ['attempted_date' => Time::now()];

        // max attempts rearched
        if ($import->get('attempts') >= (int)Configure::read('Importer.max_attempts')) {
            // set import as failed
            $data['status'] = $table::STATUS_FAIL;
            $import = $table->patchEntity($import, $data);

            return (bool)$table->save($import);
        }

        // increase attempts count
        $data['attempts'] = $import->get('attempts') + 1;
        $import = $table->patchEntity($import, $data);
        $table->save($import);

        $this->_run($import, $count);

        // mark import as completed
        $data['status'] = $table::STATUS_COMPLETED;
        $import = $table->patchEntity($import, $data);

        return (bool)$table->save($import);
    }
protected function _existingImport(ImportsTable $table, Import $import, int $count) : bool
    {
        $result = false;

        $data = ['attempted_date' => Time::now()];

        // max attempts rearched
        if ($import->get('attempts') >= (int)Configure::read('Importer.max_attempts')) {
            // set import as failed
            $data['status'] = $table::STATUS_FAIL;
            $import = $table->patchEntity($import, $data);

            return (bool)$table->save($import);
        }

        // increase attempts count
        $data['attempts'] = $import->get('attempts') + 1;
        $import = $table->patchEntity($import, $data);
        $table->save($import);

        $this->_run($import, $count);

        // mark import as completed
        $data['status'] = $table::STATUS_COMPLETED;
        $import = $table->patchEntity($import, $data);

        return (bool)$table->save($import);
    }
protected function _existingImport ( ImportsTable $ table , Import $ import , int $ count ) : bool { $ result = false ; $ data = [ 'attempted_date' => Time :: now ( ) ] ; // max attempts rearched if ( $ import -> get ( 'attempts' ) >= ( int ) Configure :: read ( 'Importer.max_attempts' ) ) { // set import as failed $ data [ 'status' ] = $ table :: STATUS_FAIL ; $ import = $ table -> patchEntity ( $ import , $ data ) ; return ( bool ) $ table -> save ( $ import ) ; } // increase attempts count $ data [ 'attempts' ] = $ import -> get ( 'attempts' ) + 1 ; $ import = $ table -> patchEntity ( $ import , $ data ) ; $ table -> save ( $ import ) ; $ this -> _run ( $ import , $ count ) ; // mark import as completed $ data [ 'status' ] = $ table :: STATUS_COMPLETED ; $ import = $ table -> patchEntity ( $ import , $ data ) ; return ( bool ) $ table -> save ( $ import ) ; }
Existing import.

@param \CsvMigrations\Model\Table\ImportsTable $table Import table instance
@param \CsvMigrations\Model\Entity\Import $import Import entity
@param int $count Progress count
@return bool
Existing import .