public function importRow(array $row)
    {

        // initialize the row
        $this->row = $row;

        // raise the line number and reset the skip row flag
        $this->lineNumber++;
        $this->skipRow = false;

        // invoke the events that has to be fired before the artfact's row will be processed
        $this->getEmitter()->emit(EventNames::SUBJECT_ARTEFACT_ROW_PROCESS_START, $this);

        // initialize the headers with the columns from the first line
        if (sizeof($this->headers) === 0) {
            foreach ($this->row as $value => $key) {
                $this->headers[$this->mapAttributeCodeByHeaderMapping($key)] = $value;
            }
            return;
        }

        // load the available observers
        $availableObservers = $this->getObservers();

        // process the observers
        foreach ($availableObservers as $observers) {
            // invoke the pre-import/import and post-import observers
            /** @var \TechDivision\Import\Observers\ObserverInterface $observer */
            foreach ($observers as $observer) {
                // query whether or not we have to skip the row
                if ($this->skipRow) {
                    // log a debug message with the actual line nr/file information
                    $this->getSystemLogger()->warning(
                        $this->appendExceptionSuffix(
                            sprintf(
                                'Skip processing operation "%s" after observer "%s"',
                                $this->operationName,
                                get_class($observer)
                            )
                        )
                    );

                    // skip the row
                    break 2;
                }

                // if not, set the subject and process the observer
                if ($observer instanceof ObserverInterface) {
                    $this->row = $observer->handle($this);
                }
            }
        }

        // query whether or not a minute has been passed
        if ($this->lastLog < time() - 60) {
            // log the number processed rows per minute
            $this->getSystemLogger()->info(
                sprintf(
                    'Successfully processed "%d (%d)" rows per minute of file "%s"',
                    $this->lineNumber - $this->lastLineNumber,
                    $this->lineNumber,
                    $this->getFilename()
                )
            );

            // reset the last log time and the line number
            $this->lastLog = time();
            $this->lastLineNumber = $this->lineNumber;
        }

        // log a debug message with the actual line nr/file information
        $this->getSystemLogger()->debug(
            $this->appendExceptionSuffix(
                sprintf(
                    'Successfully processed operation "%s"',
                    $this->operationName
                )
            )
        );

        // invoke the events that has to be fired when the artfact's row has been successfully processed
        $this->getEmitter()->emit(EventNames::SUBJECT_ARTEFACT_ROW_PROCESS_SUCCESS, $this);
    }
public function importRow(array $row)
    {

        // initialize the row
        $this->row = $row;

        // raise the line number and reset the skip row flag
        $this->lineNumber++;
        $this->skipRow = false;

        // invoke the events that has to be fired before the artfact's row will be processed
        $this->getEmitter()->emit(EventNames::SUBJECT_ARTEFACT_ROW_PROCESS_START, $this);

        // initialize the headers with the columns from the first line
        if (sizeof($this->headers) === 0) {
            foreach ($this->row as $value => $key) {
                $this->headers[$this->mapAttributeCodeByHeaderMapping($key)] = $value;
            }
            return;
        }

        // load the available observers
        $availableObservers = $this->getObservers();

        // process the observers
        foreach ($availableObservers as $observers) {
            // invoke the pre-import/import and post-import observers
            /** @var \TechDivision\Import\Observers\ObserverInterface $observer */
            foreach ($observers as $observer) {
                // query whether or not we have to skip the row
                if ($this->skipRow) {
                    // log a debug message with the actual line nr/file information
                    $this->getSystemLogger()->warning(
                        $this->appendExceptionSuffix(
                            sprintf(
                                'Skip processing operation "%s" after observer "%s"',
                                $this->operationName,
                                get_class($observer)
                            )
                        )
                    );

                    // skip the row
                    break 2;
                }

                // if not, set the subject and process the observer
                if ($observer instanceof ObserverInterface) {
                    $this->row = $observer->handle($this);
                }
            }
        }

        // query whether or not a minute has been passed
        if ($this->lastLog < time() - 60) {
            // log the number processed rows per minute
            $this->getSystemLogger()->info(
                sprintf(
                    'Successfully processed "%d (%d)" rows per minute of file "%s"',
                    $this->lineNumber - $this->lastLineNumber,
                    $this->lineNumber,
                    $this->getFilename()
                )
            );

            // reset the last log time and the line number
            $this->lastLog = time();
            $this->lastLineNumber = $this->lineNumber;
        }

        // log a debug message with the actual line nr/file information
        $this->getSystemLogger()->debug(
            $this->appendExceptionSuffix(
                sprintf(
                    'Successfully processed operation "%s"',
                    $this->operationName
                )
            )
        );

        // invoke the events that has to be fired when the artfact's row has been successfully processed
        $this->getEmitter()->emit(EventNames::SUBJECT_ARTEFACT_ROW_PROCESS_SUCCESS, $this);
    }
public function importRow ( array $ row ) { // initialize the row $ this -> row = $ row ; // raise the line number and reset the skip row flag $ this -> lineNumber ++ ; $ this -> skipRow = false ; // invoke the events that has to be fired before the artfact's row will be processed $ this -> getEmitter ( ) -> emit ( EventNames :: SUBJECT_ARTEFACT_ROW_PROCESS_START , $ this ) ; // initialize the headers with the columns from the first line if ( sizeof ( $ this -> headers ) === 0 ) { foreach ( $ this -> row as $ value => $ key ) { $ this -> headers [ $ this -> mapAttributeCodeByHeaderMapping ( $ key ) ] = $ value ; } return ; } // load the available observers $ availableObservers = $ this -> getObservers ( ) ; // process the observers foreach ( $ availableObservers as $ observers ) { // invoke the pre-import/import and post-import observers /** @var \TechDivision\Import\Observers\ObserverInterface $observer */ foreach ( $ observers as $ observer ) { // query whether or not we have to skip the row if ( $ this -> skipRow ) { // log a debug message with the actual line nr/file information $ this -> getSystemLogger ( ) -> warning ( $ this -> appendExceptionSuffix ( sprintf ( 'Skip processing operation "%s" after observer "%s"' , $ this -> operationName , get_class ( $ observer ) ) ) ) ; // skip the row break 2 ; } // if not, set the subject and process the observer if ( $ observer instanceof ObserverInterface ) { $ this -> row = $ observer -> handle ( $ this ) ; } } } // query whether or not a minute has been passed if ( $ this -> lastLog < time ( ) - 60 ) { // log the number processed rows per minute $ this -> getSystemLogger ( ) -> info ( sprintf ( 'Successfully processed "%d (%d)" rows per minute of file "%s"' , $ this -> lineNumber - $ this -> lastLineNumber , $ this -> lineNumber , $ this -> getFilename ( ) ) ) ; // reset the last log time and the line number $ this -> lastLog = time ( ) ; $ this -> lastLineNumber = $ this -> lineNumber ; } // log a debug message with the actual line nr/file information $ this -> getSystemLogger ( ) -> debug ( $ this -> appendExceptionSuffix ( sprintf ( 'Successfully processed operation "%s"' , $ this -> operationName ) ) ) ; // invoke the events that has to be fired when the artfact's row has been successfully processed $ this -> getEmitter ( ) -> emit ( EventNames :: SUBJECT_ARTEFACT_ROW_PROCESS_SUCCESS , $ this ) ; }
Imports the passed row into the database. If the import failed, the exception
will be catched and logged, but the import process will be continued.

@param array $row The row with the data to be imported

@return void
Imports the passed row into the database . If the import failed the exception will be catched and logged but the import process will be continued .