src/Kunstmaan/TranslatorBundle/Service/Command/Exporter/ExportCommandHandler.php
public function getExportFiles(ExportCommand $exportCommand)
    {
        $locales = $this->determineLocalesToImport($exportCommand);
        $domains = $this->determineDomainsToImport($exportCommand);

        $translations = $this->translationRepository->getTranslationsByLocalesAndDomains($locales, $domains);

        $translationFiles = new ArrayCollection();

        /** @var Translation $translation */
        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;
    }
public function getExportFiles(ExportCommand $exportCommand)
    {
        $locales = $this->determineLocalesToImport($exportCommand);
        $domains = $this->determineDomainsToImport($exportCommand);

        $translations = $this->translationRepository->getTranslationsByLocalesAndDomains($locales, $domains);

        $translationFiles = new ArrayCollection();

        /** @var Translation $translation */
        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;
    }
public function getExportFiles ( ExportCommand $ exportCommand ) { $ locales = $ this -> determineLocalesToImport ( $ exportCommand ) ; $ domains = $ this -> determineDomainsToImport ( $ exportCommand ) ; $ translations = $ this -> translationRepository -> getTranslationsByLocalesAndDomains ( $ locales , $ domains ) ; $ translationFiles = new ArrayCollection ( ) ; /** @var Translation $translation */ 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 ; }
Convert an exportCommand into an array of ExportFiles

@param ExportCommand $exportCommand

@return ArrayCollection an array of ExportFiles (without filecontent filled in)
Convert an exportCommand into an array of ExportFiles