/**
  * Convert an exportCommand into an array of ExportFiles
  * @param  ExportCommand $exportCommand
  * @return array         an array of ExportFiles (without filecontent filled in)
  */
 public function getExportFiles(ExportCommand $exportCommand)
 {
     $locales = $this->determineLocalesToImport($exportCommand);
     $domains = $this->determineDomainsToImport($exportCommand);
     $translations = $this->translationRepository->getTranslationsByLocalesAndDomains($locales, $domains);
     $translationFiles = new ArrayCollection();
     foreach ($translations as $translation) {
         $exportFileKey = $translation->getDomain() . '.' . $translation->getLocale() . '.' . $exportCommand->getFormat();
         if (!$translationFiles->containsKey($exportFileKey)) {
             $exportFile = new ExportFile();
             $exportFile->setExtension($exportCommand->getFormat());
             $exportFile->setDomain($translation->getDomain());
             $exportFile->setLocale($translation->getLocale());
             $translationFiles->set($exportFileKey, $exportFile);
         }
         $translationFiles->get($exportFileKey)->addTranslation($translation);
     }
     return $translationFiles;
 }
Esempio n. 2
0
 public function getExportedContent(ExportFile $exportFile)
 {
     return $this->getExporterByExtension($exportFile->getExtension())->export($exportFile->getArray());
 }