/**
  * Finds countries by territory
  *
  * @param \SJBR\StaticInfoTables\Domain\Model\Territory $territory
  *
  * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface|array
  */
 public function findByTerritory(\SJBR\StaticInfoTables\Domain\Model\Territory $territory)
 {
     $unCodeNumbers = array($territory->getUnCodeNumber());
     // Get UN code numbers of subterritories (recursively)
     $subterritories = $this->territoryRepository->findWithinTerritory($territory);
     foreach ($subterritories as $subterritory) {
         $unCodeNumbers[] = $subterritory->getUnCodeNumber();
     }
     $query = $this->createQuery();
     $query->matching($query->in('parentTerritoryUnCodeNumber', $unCodeNumbers));
     return $query->execute();
 }
Exemple #2
0
 /**
  * Gets the update queries for this language pack
  *
  * @return string update queries in sql format
  */
 public function getUpdateQueries()
 {
     $updateQueries = array();
     $locale = $this->getLocale();
     $updateQueries = array_merge($updateQueries, $this->countryRepository->getUpdateQueries($locale));
     $updateQueries = array_merge($updateQueries, $this->countryZoneRepository->getUpdateQueries($locale));
     $updateQueries = array_merge($updateQueries, $this->currencyRepository->getUpdateQueries($locale));
     $updateQueries = array_merge($updateQueries, $this->languageRepository->getUpdateQueries($locale));
     $updateQueries = array_merge($updateQueries, $this->territoryRepository->getUpdateQueries($locale));
     return implode(LF, $updateQueries);
 }
 /**
  * Creation/update a language pack for the Static Info Tables
  *
  * @return string An HTML display of data overview
  */
 public function sqlDumpNonLocalizedDataAction()
 {
     // Create a SQL dump of non-localized data
     $dumpContent = array();
     $dumpContent[] = $this->countryRepository->sqlDumpNonLocalizedData();
     $dumpContent[] = $this->countryZoneRepository->sqlDumpNonLocalizedData();
     $dumpContent[] = $this->currencyRepository->sqlDumpNonLocalizedData();
     $dumpContent[] = $this->languageRepository->sqlDumpNonLocalizedData();
     $dumpContent[] = $this->territoryRepository->sqlDumpNonLocalizedData();
     // Write the SQL dump file
     $extensionKey = \TYPO3\CMS\Core\Utility\GeneralUtility::camelCaseToLowerCaseUnderscored($this->extensionName);
     $extensionPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($extensionKey);
     $filename = 'export-ext_tables_static+adt.sql';
     \TYPO3\CMS\Core\Utility\GeneralUtility::writeFile($extensionPath . $filename, implode(LF, $dumpContent));
     $message = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('sqlDumpCreated', $this->extensionName) . ' ' . $extensionPath . $filename;
     $this->addFlashMessage($message, '', \TYPO3\CMS\Core\Messaging\AbstractMessage::OK);
     $this->forward('information');
 }