src/Sulu/Component/Snippet/Import/SnippetImport.php
public function import($locale, $filePath, OutputInterface $output = null, $format = '1.2.xliff')
    {
        $parsedDataList = $this->getParser($format)->parse($filePath, $locale);
        $failedImports = [];
        $importedCounter = 0;
        $successCounter = 0;

        if (null === $output) {
            $output = new NullOutput();
        }

        $progress = new ProgressBar($output, count($parsedDataList));
        $progress->setFormat(' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% %memory:6s%');
        $progress->start();

        foreach ($parsedDataList as $parsedData) {
            ++$importedCounter;

            if (!$this->importDocument($parsedData, $locale, $format)) {
                $failedImports[] = $parsedData;
            } else {
                ++$successCounter;
            }

            $this->logger->info(sprintf('Document %s/%s', $importedCounter, count($parsedDataList)));

            $progress->advance();
        }

        $progress->finish();

        $return = new \stdClass();
        $return->count = $importedCounter;
        $return->fails = count($failedImports);
        $return->successes = $successCounter;
        $return->failed = $failedImports;
        $return->exceptionStore = $this->exceptionStore;

        return $return;
    }
public function import($locale, $filePath, OutputInterface $output = null, $format = '1.2.xliff')
    {
        $parsedDataList = $this->getParser($format)->parse($filePath, $locale);
        $failedImports = [];
        $importedCounter = 0;
        $successCounter = 0;

        if (null === $output) {
            $output = new NullOutput();
        }

        $progress = new ProgressBar($output, count($parsedDataList));
        $progress->setFormat(' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% %memory:6s%');
        $progress->start();

        foreach ($parsedDataList as $parsedData) {
            ++$importedCounter;

            if (!$this->importDocument($parsedData, $locale, $format)) {
                $failedImports[] = $parsedData;
            } else {
                ++$successCounter;
            }

            $this->logger->info(sprintf('Document %s/%s', $importedCounter, count($parsedDataList)));

            $progress->advance();
        }

        $progress->finish();

        $return = new \stdClass();
        $return->count = $importedCounter;
        $return->fails = count($failedImports);
        $return->successes = $successCounter;
        $return->failed = $failedImports;
        $return->exceptionStore = $this->exceptionStore;

        return $return;
    }
public function import ( $ locale , $ filePath , OutputInterface $ output = null , $ format = '1.2.xliff' ) { $ parsedDataList = $ this -> getParser ( $ format ) -> parse ( $ filePath , $ locale ) ; $ failedImports = [ ] ; $ importedCounter = 0 ; $ successCounter = 0 ; if ( null === $ output ) { $ output = new NullOutput ( ) ; } $ progress = new ProgressBar ( $ output , count ( $ parsedDataList ) ) ; $ progress -> setFormat ( ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% %memory:6s%' ) ; $ progress -> start ( ) ; foreach ( $ parsedDataList as $ parsedData ) { ++ $ importedCounter ; if ( ! $ this -> importDocument ( $ parsedData , $ locale , $ format ) ) { $ failedImports [ ] = $ parsedData ; } else { ++ $ successCounter ; } $ this -> logger -> info ( sprintf ( 'Document %s/%s' , $ importedCounter , count ( $ parsedDataList ) ) ) ; $ progress -> advance ( ) ; } $ progress -> finish ( ) ; $ return = new \ stdClass ( ) ; $ return -> count = $ importedCounter ; $ return -> fails = count ( $ failedImports ) ; $ return -> successes = $ successCounter ; $ return -> failed = $ failedImports ; $ return -> exceptionStore = $ this -> exceptionStore ; return $ return ; }
Import Snippet by given XLIFF-File.

@param string $locale
@param string $filePath
@param OutputInterface $output
@param string $format

@return \stdClass

@throws FormatImporterNotFoundException
Import Snippet by given XLIFF - File .