public function execute(SubjectConfigurationInterface $subject, array $matches, $serial, $pathname)
    {

        // initialize the subject and import the bunch
        $subjectInstance = $this->subjectFactory->createSubject($subject);

        try {
            // setup the subject instance
            $subjectInstance->setUp($serial);

            // initialize the callbacks/observers
            $this->callbackVisitor->visit($subjectInstance);
            $this->observerVisitor->visit($subjectInstance);

            // finally import the CSV file
            $subjectInstance->import($serial, $pathname);

            // query whether or not, we've to export artefacts
            if ($subjectInstance instanceof ExportableSubjectInterface) {
                $subjectInstance->export(
                    $matches[BunchKeys::FILENAME],
                    $matches[BunchKeys::COUNTER]
                );
            }

            // tear down the subject instance
            $subjectInstance->tearDown($serial);
        } catch (\Exception $e) {
            // query whether or not, we've to export artefacts
            if ($subjectInstance instanceof ExportableSubjectInterface) {
                // tear down the subject instance
                $subjectInstance->tearDown($serial);
            }

            // re-throw the exception
            throw $e;
        }
    }
public function execute(SubjectConfigurationInterface $subject, array $matches, $serial, $pathname)
    {

        // initialize the subject and import the bunch
        $subjectInstance = $this->subjectFactory->createSubject($subject);

        try {
            // setup the subject instance
            $subjectInstance->setUp($serial);

            // initialize the callbacks/observers
            $this->callbackVisitor->visit($subjectInstance);
            $this->observerVisitor->visit($subjectInstance);

            // finally import the CSV file
            $subjectInstance->import($serial, $pathname);

            // query whether or not, we've to export artefacts
            if ($subjectInstance instanceof ExportableSubjectInterface) {
                $subjectInstance->export(
                    $matches[BunchKeys::FILENAME],
                    $matches[BunchKeys::COUNTER]
                );
            }

            // tear down the subject instance
            $subjectInstance->tearDown($serial);
        } catch (\Exception $e) {
            // query whether or not, we've to export artefacts
            if ($subjectInstance instanceof ExportableSubjectInterface) {
                // tear down the subject instance
                $subjectInstance->tearDown($serial);
            }

            // re-throw the exception
            throw $e;
        }
    }
public function execute ( SubjectConfigurationInterface $ subject , array $ matches , $ serial , $ pathname ) { // initialize the subject and import the bunch $ subjectInstance = $ this -> subjectFactory -> createSubject ( $ subject ) ; try { // setup the subject instance $ subjectInstance -> setUp ( $ serial ) ; // initialize the callbacks/observers $ this -> callbackVisitor -> visit ( $ subjectInstance ) ; $ this -> observerVisitor -> visit ( $ subjectInstance ) ; // finally import the CSV file $ subjectInstance -> import ( $ serial , $ pathname ) ; // query whether or not, we've to export artefacts if ( $ subjectInstance instanceof ExportableSubjectInterface ) { $ subjectInstance -> export ( $ matches [ BunchKeys :: FILENAME ] , $ matches [ BunchKeys :: COUNTER ] ) ; } // tear down the subject instance $ subjectInstance -> tearDown ( $ serial ) ; } catch ( \ Exception $ e ) { // query whether or not, we've to export artefacts if ( $ subjectInstance instanceof ExportableSubjectInterface ) { // tear down the subject instance $ subjectInstance -> tearDown ( $ serial ) ; } // re-throw the exception throw $ e ; } }
Executes the passed subject.

@param \TechDivision\Import\Configuration\SubjectConfigurationInterface $subject  The message with the subject information
@param array                                                            $matches  The bunch matches
@param string                                                           $serial   The UUID of the actual import
@param string                                                           $pathname The path to the file to import

@return void
Executes the passed subject .