public function start($identifier = null, $force = false)
    {
        if ($this->currentImport instanceof Import) {
            throw new Exception('Unable to start a new import, please stop the current import first', 1426638560);
        }

        if ($identifier !== null) {
            $existingImport = $this->importRepository->findOneByExternalImportIdentifier($identifier);
            if (!$force  && $existingImport instanceof Import) {
                throw new ImportAlreadyExecutedException(sprintf('An import referring to the external identifier "%s" has already been executed on %s.', $identifier, $existingImport->getStartTime()->format('d.m.Y h:m:s')), 1464028408403);
            }
        }

        $this->currentImport = new Import();
        $this->currentImport->setExternalImportIdentifier($identifier);

        if ($force && isset($existingImport)) {
            $this->addEventMessage(sprintf('ImportService:start', 'Forcing re-import of data set with external identifier "%s".', $identifier), LOG_NOTICE);
        }

        $this->importRepository->add($this->currentImport);
        $this->persistenceManager->persistAll();
    }
public function start($identifier = null, $force = false)
    {
        if ($this->currentImport instanceof Import) {
            throw new Exception('Unable to start a new import, please stop the current import first', 1426638560);
        }

        if ($identifier !== null) {
            $existingImport = $this->importRepository->findOneByExternalImportIdentifier($identifier);
            if (!$force  && $existingImport instanceof Import) {
                throw new ImportAlreadyExecutedException(sprintf('An import referring to the external identifier "%s" has already been executed on %s.', $identifier, $existingImport->getStartTime()->format('d.m.Y h:m:s')), 1464028408403);
            }
        }

        $this->currentImport = new Import();
        $this->currentImport->setExternalImportIdentifier($identifier);

        if ($force && isset($existingImport)) {
            $this->addEventMessage(sprintf('ImportService:start', 'Forcing re-import of data set with external identifier "%s".', $identifier), LOG_NOTICE);
        }

        $this->importRepository->add($this->currentImport);
        $this->persistenceManager->persistAll();
    }
public function start ( $ identifier = null , $ force = false ) { if ( $ this -> currentImport instanceof Import ) { throw new Exception ( 'Unable to start a new import, please stop the current import first' , 1426638560 ) ; } if ( $ identifier !== null ) { $ existingImport = $ this -> importRepository -> findOneByExternalImportIdentifier ( $ identifier ) ; if ( ! $ force && $ existingImport instanceof Import ) { throw new ImportAlreadyExecutedException ( sprintf ( 'An import referring to the external identifier "%s" has already been executed on %s.' , $ identifier , $ existingImport -> getStartTime ( ) -> format ( 'd.m.Y h:m:s' ) ) , 1464028408403 ) ; } } $ this -> currentImport = new Import ( ) ; $ this -> currentImport -> setExternalImportIdentifier ( $ identifier ) ; if ( $ force && isset ( $ existingImport ) ) { $ this -> addEventMessage ( sprintf ( 'ImportService:start' , 'Forcing re-import of data set with external identifier "%s".' , $ identifier ) , LOG_NOTICE ) ; } $ this -> importRepository -> add ( $ this -> currentImport ) ; $ this -> persistenceManager -> persistAll ( ) ; }
Start a new Import

@param string $identifier
@param boolean $force
@throws Exception
@throws \Neos\Flow\Persistence\Exception\IllegalObjectTypeException
Start a new Import