src/Shell/ImportShell.php
protected function _run(Import $import, int $count) : void
    {
        // generate import results records
        $this->createImportResults($import, $count);

        $this->out('Importing records ..');
        $progress = $this->helper('Progress');
        Assert::isInstanceOf($progress, ProgressHelper::class);
        $progress->init();

        $headers = ImportUtility::getUploadHeaders($import);
        $filename = ImportUtility::getProcessedFile($import);
        $reader = Reader::createFromPath($filename, 'r');
        foreach ($reader as $index => $row) {
            // skip first csv row
            if (0 === $index) {
                continue;
            }

            // skip empty row
            if (empty($row)) {
                continue;
            }

            $this->_importResult($import, $headers, $index, $row);

            $progress->increment(100 / $count);
            $progress->draw();
        }

        $this->out(null);
    }
protected function _run(Import $import, int $count) : void
    {
        // generate import results records
        $this->createImportResults($import, $count);

        $this->out('Importing records ..');
        $progress = $this->helper('Progress');
        Assert::isInstanceOf($progress, ProgressHelper::class);
        $progress->init();

        $headers = ImportUtility::getUploadHeaders($import);
        $filename = ImportUtility::getProcessedFile($import);
        $reader = Reader::createFromPath($filename, 'r');
        foreach ($reader as $index => $row) {
            // skip first csv row
            if (0 === $index) {
                continue;
            }

            // skip empty row
            if (empty($row)) {
                continue;
            }

            $this->_importResult($import, $headers, $index, $row);

            $progress->increment(100 / $count);
            $progress->draw();
        }

        $this->out(null);
    }
protected function _run ( Import $ import , int $ count ) : void { // generate import results records $ this -> createImportResults ( $ import , $ count ) ; $ this -> out ( 'Importing records ..' ) ; $ progress = $ this -> helper ( 'Progress' ) ; Assert :: isInstanceOf ( $ progress , ProgressHelper :: class ) ; $ progress -> init ( ) ; $ headers = ImportUtility :: getUploadHeaders ( $ import ) ; $ filename = ImportUtility :: getProcessedFile ( $ import ) ; $ reader = Reader :: createFromPath ( $ filename , 'r' ) ; foreach ( $ reader as $ index => $ row ) { // skip first csv row if ( 0 === $ index ) { continue ; } // skip empty row if ( empty ( $ row ) ) { continue ; } $ this -> _importResult ( $ import , $ headers , $ index , $ row ) ; $ progress -> increment ( 100 / $ count ) ; $ progress -> draw ( ) ; } $ this -> out ( null ) ; }
Run data import.

@param \CsvMigrations\Model\Entity\Import $import Import entity
@param int $count Progress count
@return void
Run data import .