[CLEANUP] Autoformat the code with php-cs-fixer 75/58675/2
authorOliver Klee <typo3-coding@oliverklee.de>
Tue, 23 Oct 2018 15:25:14 +0000 (17:25 +0200)
committerStanislas Rolland <typo3@sjbr.ca>
Tue, 23 Oct 2018 16:02:42 +0000 (18:02 +0200)
This will avoid unrelated formatting changes in functional changes.

Change-Id: I99987e65a088282437eb88cc2c9bbfd8d80afea0
Resolves: #86723
Reviewed-on: https://review.typo3.org/58675
Reviewed-by: Stanislas Rolland <typo3@sjbr.ca>
Tested-by: Stanislas Rolland <typo3@sjbr.ca>
63 files changed:
Classes/Cache/CachedClassLoader.php
Classes/Cache/ClassCacheManager.php
Classes/Configuration/TypoScript/ConfigurationHelper.php
Classes/Controller/ManagerController.php
Classes/Domain/Model/AbstractEntity.php
Classes/Domain/Model/Country.php
Classes/Domain/Model/CountryZone.php
Classes/Domain/Model/Currency.php
Classes/Domain/Model/Language.php
Classes/Domain/Model/LanguagePack.php
Classes/Domain/Model/SystemLanguage.php
Classes/Domain/Model/Territory.php
Classes/Domain/Repository/AbstractEntityRepository.php
Classes/Domain/Repository/CountryRepository.php
Classes/Domain/Repository/CountryZoneRepository.php
Classes/Domain/Repository/CurrencyRepository.php
Classes/Domain/Repository/LanguagePackRepository.php
Classes/Domain/Repository/LanguageRepository.php
Classes/Domain/Repository/SystemLanguageRepository.php
Classes/Domain/Repository/TerritoryRepository.php
Classes/Hook/Backend/Form/FormDataProvider/SuggestLabelProcessor.php
Classes/Hook/Backend/Form/FormDataProvider/TcaLabelProcessor.php
Classes/Hook/Backend/Form/FormDataProvider/TcaSelectItemsProcessor.php
Classes/Hook/Backend/Form/Wizard/SuggestReceiver.php
Classes/Hook/Backend/Recordlist/BuildQueryParameters.php
Classes/Hook/Backend/Recordlist/ModifyQuery.php
Classes/Hook/Core/DataHandling/ProcessDataMap.php
Classes/PiBaseApi.php
Classes/Service/SqlSchemaMigrationService.php
Classes/Slot/Extensionmanager/AfterExtensionInstall.php
Classes/Utility/DatabaseUpdateUtility.php
Classes/Utility/DatabaseUtility.php
Classes/Utility/HtmlElementUtility.php
Classes/Utility/LocaleUtility.php
Classes/Utility/LocalizationUtility.php
Classes/Utility/ModelUtility.php
Classes/ViewHelpers/Form/SelectViewHelper.php
Configuration/TCA/Overrides/StaticFiles.php
Configuration/TCA/Overrides/enable_editing.php
Configuration/TCA/Overrides/sys_language.php
Configuration/TCA/static_countries.php
Configuration/TCA/static_country_zones.php
Configuration/TCA/static_currencies.php
Configuration/TCA/static_languages.php
Configuration/TCA/static_territories.php
Configuration/TypoScript/Manager/setup.txt
Configuration/TypoScript/Static/constants.txt
Configuration/TypoScript/Static/setup.txt
Resources/Private/LanguagePackTemplate/Configuration/TCA/Overrides/static_countries.php
Resources/Private/LanguagePackTemplate/Configuration/TCA/Overrides/static_country_zones.php
Resources/Private/LanguagePackTemplate/Configuration/TCA/Overrides/static_currencies.php
Resources/Private/LanguagePackTemplate/Configuration/TCA/Overrides/static_languages.php
Resources/Private/LanguagePackTemplate/Configuration/TCA/Overrides/static_territories.php
Resources/Private/LanguagePackTemplate/ext_emconf.php
Resources/Private/LanguagePackTemplate/ext_localconf.php
Resources/Public/StyleSheets/manager.css
Tests/Unit/Domain/Repository/AbstractEntityRepositoryTest.php
class.ext_update.php
ext_autoload.php
ext_emconf.php
ext_localconf.php
ext_tables.php
pi1/class.tx_staticinfotables_pi1.php

index 9faee03..d235d7a 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 namespace SJBR\StaticInfoTables\Cache;
+
 /***************************************************************
  *  Copyright notice
  *
@@ -26,78 +27,80 @@ namespace SJBR\StaticInfoTables\Cache;
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
 
-use \TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
 
 /**
  * Cached classes autoloader
- *
  */
-class CachedClassLoader {
-
-       /**
-        * Extension key
-        *
-        * @var string
-        */
-       static protected $extensionKey = 'static_info_tables';
-
-       /**
-        * Cached class loader class name
-        *
-        * @var string
-        */
-       static protected $className = __CLASS__;
+class CachedClassLoader
+{
+    /**
+     * Extension key
+     *
+     * @var string
+     */
+    protected static $extensionKey = 'static_info_tables';
 
-       /**
-        * Name space of the Domain Model of StaticInfoTables
-        *
-        * @var string
-        */
-       static protected $namespace = 'SJBR\\StaticInfoTables\\Domain\\Model\\';
+    /**
+     * Cached class loader class name
+     *
+     * @var string
+     */
+    protected static $className = __CLASS__;
 
-       /**
-        * The class loader is static, thus we do not allow instances of this class.
-        */
-       private function __construct() {
+    /**
+     * Name space of the Domain Model of StaticInfoTables
+     *
+     * @var string
+     */
+    protected static $namespace = 'SJBR\\StaticInfoTables\\Domain\\Model\\';
 
-       }
+    /**
+     * The class loader is static, thus we do not allow instances of this class.
+     */
+    private function __construct()
+    {
+    }
 
-       /**
-        * Registers the cached class loader
-        *
-        * @return boolean TRUE in case of success
-        */
-       static public function registerAutoloader() {
-               return spl_autoload_register(static::$className . '::autoload', TRUE, TRUE);
-       }
+    /**
+     * Registers the cached class loader
+     *
+     * @return bool TRUE in case of success
+     */
+    public static function registerAutoloader()
+    {
+        return spl_autoload_register(static::$className . '::autoload', true, true);
+    }
 
-       /**
-        * Autoload function for cached classes
-        *
-        * @param string $className Class name
-        * @return void
-        */
-       static public function autoload($className) {
-               $className = ltrim($className, '\\');
-               if (strpos($className, static::$namespace) !== FALSE) {
-                       // Lookup the class in the array of static info entities and check its presence in the class cache
-                       $entities = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][static::$extensionKey]['entities'];
-                       $objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
-                       $cacheManager = $objectManager->get('TYPO3\\CMS\\Core\\Cache\\CacheManager');
-                       // ClassCacheManager instantiation creates the class cache if not already available
-                       $classCacheManager = $objectManager->get('SJBR\\StaticInfoTables\\Cache\\ClassCacheManager');
-                       $classCache = $cacheManager->getCache(static::$extensionKey);
-                       foreach ($entities as $entity) {
-                               if ($className === static::$namespace . $entity) {
-                                       $entryIdentifier = 'DomainModel' . $entity;
-                                       if (!$classCache->has($entryIdentifier)) {
-                                               // The class cache needs to be rebuilt
-                                               $classCacheManager->reBuild();
-                                       }
-                                       $classCache->requireOnce($entryIdentifier);
-                                       break;
-                               }
-                       }
-               }
-       }
-}
\ No newline at end of file
+    /**
+     * Autoload function for cached classes
+     *
+     * @param string $className Class name
+     *
+     * @return void
+     */
+    public static function autoload($className)
+    {
+        $className = ltrim($className, '\\');
+        if (strpos($className, static::$namespace) !== false) {
+            // Lookup the class in the array of static info entities and check its presence in the class cache
+            $entities = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][static::$extensionKey]['entities'];
+            $objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
+            $cacheManager = $objectManager->get('TYPO3\\CMS\\Core\\Cache\\CacheManager');
+            // ClassCacheManager instantiation creates the class cache if not already available
+            $classCacheManager = $objectManager->get('SJBR\\StaticInfoTables\\Cache\\ClassCacheManager');
+            $classCache = $cacheManager->getCache(static::$extensionKey);
+            foreach ($entities as $entity) {
+                if ($className === static::$namespace . $entity) {
+                    $entryIdentifier = 'DomainModel' . $entity;
+                    if (!$classCache->has($entryIdentifier)) {
+                        // The class cache needs to be rebuilt
+                        $classCacheManager->reBuild();
+                    }
+                    $classCache->requireOnce($entryIdentifier);
+                    break;
+                }
+            }
+        }
+    }
+}
index 7778e24..26a2f06 100644 (file)
@@ -20,8 +20,8 @@ namespace SJBR\StaticInfoTables\Cache;
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
 
-use TYPO3\CMS\Core\SingletonInterface;
 use TYPO3\CMS\Core\Cache\CacheManager;
+use TYPO3\CMS\Core\SingletonInterface;
 use TYPO3\CMS\Core\Utility\ArrayUtility;
 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
@@ -29,254 +29,258 @@ use TYPO3\CMS\Extbase\Object\ObjectManager;
 
 /**
  * Class Cache Manager
- *
  */
 class ClassCacheManager implements SingletonInterface
 {
-       /**
-        * Extension key
-        *
-        * @var string
-        */
-       protected $extensionKey = 'static_info_tables';
+    /**
+     * Extension key
+     *
+     * @var string
+     */
+    protected $extensionKey = 'static_info_tables';
 
-       /**
-        * @var array Cache configurations
-        */
-       protected $cacheConfiguration = array(
-               'static_info_tables' => array(
-                       'frontend' => 'TYPO3\\CMS\\Core\\Cache\\Frontend\\PhpFrontend',
-                       'backend' => 'TYPO3\\CMS\\Core\\Cache\\Backend\\FileBackend',
-                       'options' => array(),
-                       'groups' => array('all')
-               )
-       );
+    /**
+     * @var array Cache configurations
+     */
+    protected $cacheConfiguration = [
+        'static_info_tables' => [
+            'frontend' => 'TYPO3\\CMS\\Core\\Cache\\Frontend\\PhpFrontend',
+            'backend' => 'TYPO3\\CMS\\Core\\Cache\\Backend\\FileBackend',
+            'options' => [],
+            'groups' => ['all'],
+        ],
+    ];
 
-       /**
-        * @var \TYPO3\CMS\Extbase\Object\ObjectManager
-        */
-       protected $objectManager;
+    /**
+     * @var \TYPO3\CMS\Extbase\Object\ObjectManager
+     */
+    protected $objectManager;
 
-       /**
-        * @var \TYPO3\CMS\Core\Cache\CacheManager
-        */
-       protected $cacheManager;
+    /**
+     * @var \TYPO3\CMS\Core\Cache\CacheManager
+     */
+    protected $cacheManager;
 
-       /**
-        * @var \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface
-        */
-       protected $cacheInstance;
+    /**
+     * @var \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface
+     */
+    protected $cacheInstance;
 
-       /**
-        * Constructor
-        */
-       public function __construct()
-       {
-               $this->objectManager = GeneralUtility::makeInstance(ObjectManager::class);
-               $this->initializeCache();
-       }
+    /**
+     * Constructor
+     */
+    public function __construct()
+    {
+        $this->objectManager = GeneralUtility::makeInstance(ObjectManager::class);
+        $this->initializeCache();
+    }
 
-       /**
-        * Initialize cache instance to be ready to use
-        *
-        * @return void
-        */
-       protected function initializeCache()
-       {
-               $this->cacheManager = $this->objectManager->get(CacheManager::class);
-               if (!$this->cacheManager->hasCache($this->extensionKey)) {
-                       if (is_array($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'][$this->extensionKey])) {
-                                       ArrayUtility::mergeRecursiveWithOverrule($this->cacheConfiguration[$this->extensionKey], $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'][$this->extensionKey]);
-                       }
-                       $this->cacheManager->setCacheConfigurations($this->cacheConfiguration);
-               }
-               $this->cacheInstance = $this->cacheManager->getCache($this->extensionKey);
-       }
+    /**
+     * Initialize cache instance to be ready to use
+     *
+     * @return void
+     */
+    protected function initializeCache()
+    {
+        $this->cacheManager = $this->objectManager->get(CacheManager::class);
+        if (!$this->cacheManager->hasCache($this->extensionKey)) {
+            if (is_array($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'][$this->extensionKey])) {
+                ArrayUtility::mergeRecursiveWithOverrule($this->cacheConfiguration[$this->extensionKey], $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'][$this->extensionKey]);
+            }
+            $this->cacheManager->setCacheConfigurations($this->cacheConfiguration);
+        }
+        $this->cacheInstance = $this->cacheManager->getCache($this->extensionKey);
+    }
 
-       /**
-        * Builds and caches the proxy files
-        *
-        * @return void
-        * @throws Exception
-        */
-       public function build()
-       {
-               $extensibleExtensions = $this->getExtensibleExtensions();
-               $entities = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extensionKey]['entities'];
-               foreach ($entities as $entity) {
-                       $key = 'Domain/Model/' . $entity;
+    /**
+     * Builds and caches the proxy files
+     *
+     * @return void
+     *
+     * @throws Exception
+     */
+    public function build()
+    {
+        $extensibleExtensions = $this->getExtensibleExtensions();
+        $entities = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extensionKey]['entities'];
+        foreach ($entities as $entity) {
+            $key = 'Domain/Model/' . $entity;
 
-                       // Get the file from static_info_tables itself, this needs to be loaded as first
-                       $path = ExtensionManagementUtility::extPath($this->extensionKey) . 'Classes/' . $key . '.php';
-                       if (!is_file($path)) {
-                               throw new Exception('given file "' . $path . '" does not exist');
-                       }
-                       $code = $this->parseSingleFile($path, false);
+            // Get the file from static_info_tables itself, this needs to be loaded as first
+            $path = ExtensionManagementUtility::extPath($this->extensionKey) . 'Classes/' . $key . '.php';
+            if (!is_file($path)) {
+                throw new Exception('given file "' . $path . '" does not exist');
+            }
+            $code = $this->parseSingleFile($path, false);
 
-                       // Get the files from all other extensions that are extending this domain model class
-                       if (isset($extensibleExtensions[$key]) && is_array($extensibleExtensions[$key]) && count($extensibleExtensions[$key]) > 0) {
-                               $extensionsWithThisClass = array_keys($extensibleExtensions[$key]);
-                               foreach ($extensionsWithThisClass as $extension) {
-                                       $path = ExtensionManagementUtility::extPath($extension) . 'Classes/' . $key . '.php';
-                                       if (is_file($path)) {
-                                               $code .= $this->parseSingleFile($path);
-                                       }
-                               }
-                       }
+            // Get the files from all other extensions that are extending this domain model class
+            if (isset($extensibleExtensions[$key]) && is_array($extensibleExtensions[$key]) && count($extensibleExtensions[$key]) > 0) {
+                $extensionsWithThisClass = array_keys($extensibleExtensions[$key]);
+                foreach ($extensionsWithThisClass as $extension) {
+                    $path = ExtensionManagementUtility::extPath($extension) . 'Classes/' . $key . '.php';
+                    if (is_file($path)) {
+                        $code .= $this->parseSingleFile($path);
+                    }
+                }
+            }
 
-                       // Close the class definition and the php tag
-                       $code =  $this->closeClassDefinition($code);
+            // Close the class definition and the php tag
+            $code =  $this->closeClassDefinition($code);
 
-                       // The file is added to the class cache
-                       $entryIdentifier = str_replace('/', '', $key);
-                       try {
-                               $this->cacheInstance->set($entryIdentifier, $code);
-                       } catch (Exception $e) {
-                               throw new Exception($e->getMessage());
-                       }
-               }
-       }
+            // The file is added to the class cache
+            $entryIdentifier = str_replace('/', '', $key);
+            try {
+                $this->cacheInstance->set($entryIdentifier, $code);
+            } catch (Exception $e) {
+                throw new Exception($e->getMessage());
+            }
+        }
+    }
 
-       /**
-        * Get all loaded extensions which try to extend EXT:static_info_tables
-        *
-        * @return array
-        */
-       protected function getExtensibleExtensions()
-       {
-               $loadedExtensions = array_unique(ExtensionManagementUtility::getLoadedExtensionListArray());
+    /**
+     * Get all loaded extensions which try to extend EXT:static_info_tables
+     *
+     * @return array
+     */
+    protected function getExtensibleExtensions()
+    {
+        $loadedExtensions = array_unique(ExtensionManagementUtility::getLoadedExtensionListArray());
 
-               // Get the extensions which want to extend static_info_tables
-               $extensibleExtensions = array();
-               foreach ($loadedExtensions as $extensionKey) {
-                       $extensionInfoFile = ExtensionManagementUtility::extPath($extensionKey) . 'Configuration/DomainModelExtension/StaticInfoTables.txt';
-                       if (file_exists($extensionInfoFile)) {
-                               $info = GeneralUtility::getUrl($extensionInfoFile);
-                               $classes = GeneralUtility::trimExplode(LF, $info, true);
-                               foreach ($classes as $class) {
-                                       $extensibleExtensions[$class][$extensionKey] = 1;
-                               }
-                       }
-               }
-               return $extensibleExtensions;
-       }
+        // Get the extensions which want to extend static_info_tables
+        $extensibleExtensions = [];
+        foreach ($loadedExtensions as $extensionKey) {
+            $extensionInfoFile = ExtensionManagementUtility::extPath($extensionKey) . 'Configuration/DomainModelExtension/StaticInfoTables.txt';
+            if (file_exists($extensionInfoFile)) {
+                $info = GeneralUtility::getUrl($extensionInfoFile);
+                $classes = GeneralUtility::trimExplode(LF, $info, true);
+                foreach ($classes as $class) {
+                    $extensibleExtensions[$class][$extensionKey] = 1;
+                }
+            }
+        }
+        return $extensibleExtensions;
+    }
 
-       /**
-        * Parse a single file and does some magic
-        * - Remove the php tags
-        * - Remove the class definition (if set)
-        *
-        * @param string $filePath path of the file
-        * @param boolean $removeClassDefinition If class definition should be removed
-        * @return string path of the saved file
-        * @throws Exception
-        * @throws InvalidArgumentException
-        */
-       public function parseSingleFile($filePath, $removeClassDefinition = true)
-       {
-               if (!is_file($filePath)) {
-                       throw new InvalidArgumentException(sprintf('File "%s" could not be found', $filePath));
-               }
-               $code = GeneralUtility::getUrl($filePath);
-               return $this->changeCode($code, $filePath, $removeClassDefinition);
-       }
+    /**
+     * Parse a single file and does some magic
+     * - Remove the php tags
+     * - Remove the class definition (if set)
+     *
+     * @param string $filePath path of the file
+     * @param bool $removeClassDefinition If class definition should be removed
+     *
+     * @return string path of the saved file
+     *
+     * @throws Exception
+     * @throws InvalidArgumentException
+     */
+    public function parseSingleFile($filePath, $removeClassDefinition = true)
+    {
+        if (!is_file($filePath)) {
+            throw new InvalidArgumentException(sprintf('File "%s" could not be found', $filePath));
+        }
+        $code = GeneralUtility::getUrl($filePath);
+        return $this->changeCode($code, $filePath, $removeClassDefinition);
+    }
 
-       /**
-        * @param string $code
-        * @param string $filePath
-        * @param boolean $removeClassDefinition
-        * @param boolean $renderPartialInfo
-        * @return string
-        * @throws Exception
-        */
-       protected function changeCode($code, $filePath, $removeClassDefinition = true, $renderPartialInfo = true)
-       {
-               if (empty($code)) {
-                       throw new InvalidArgumentException(sprintf('File "%s" could not be fetched or is empty', $filePath));
-               }
-               $code = trim($code);
-               $code = str_replace(array('<?php', '?>'), '', $code);
-               $code = trim($code);
+    /**
+     * @param string $code
+     * @param string $filePath
+     * @param bool $removeClassDefinition
+     * @param bool $renderPartialInfo
+     *
+     * @return string
+     *
+     * @throws Exception
+     */
+    protected function changeCode($code, $filePath, $removeClassDefinition = true, $renderPartialInfo = true)
+    {
+        if (empty($code)) {
+            throw new InvalidArgumentException(sprintf('File "%s" could not be fetched or is empty', $filePath));
+        }
+        $code = trim($code);
+        $code = str_replace(['<?php', '?>'], '', $code);
+        $code = trim($code);
 
-               // Remove everything before 'class ', including namespaces,
-               // comments and require-statements.
-               if ($removeClassDefinition) {
-                       $pos = strpos($code, 'class ');
-                       $pos2 = strpos($code, '{', $pos);
+        // Remove everything before 'class ', including namespaces,
+        // comments and require-statements.
+        if ($removeClassDefinition) {
+            $pos = strpos($code, 'class ');
+            $pos2 = strpos($code, '{', $pos);
 
-                       $code = substr($code, $pos2 + 1);
-               }
+            $code = substr($code, $pos2 + 1);
+        }
 
-               $code = trim($code);
+        $code = trim($code);
 
-               // Add some information for each partial
-               if ($renderPartialInfo) {
-                       $code = $this->getPartialInfo($filePath) . $code;
-               }
+        // Add some information for each partial
+        if ($renderPartialInfo) {
+            $code = $this->getPartialInfo($filePath) . $code;
+        }
 
-               // Remove last }
-               $pos = strrpos($code, '}');
-               $code = substr($code, 0, $pos);
-               $code = trim($code);
-               return $code . LF . LF;
-       }
+        // Remove last }
+        $pos = strrpos($code, '}');
+        $code = substr($code, 0, $pos);
+        $code = trim($code);
+        return $code . LF . LF;
+    }
 
-       protected function getPartialInfo($filePath)
-       {
-               return '/*' . str_repeat('*', 70) . LF .
-                       ' * this is partial from: ' . $filePath . LF . str_repeat('*', 70) . '*/' . LF . chr(9);
-       }
+    protected function getPartialInfo($filePath)
+    {
+        return '/*' . str_repeat('*', 70) . LF .
+            ' * this is partial from: ' . $filePath . LF . str_repeat('*', 70) . '*/' . LF . chr(9);
+    }
 
-       protected function closeClassDefinition($code)
-       {
-               return $code . LF . '}';
-       }
+    protected function closeClassDefinition($code)
+    {
+        return $code . LF . '}';
+    }
 
-       /**
-        * Clear the class cache
-        *
-        * @return void
-        */
-       public function clear()
-       {
-               $this->cacheInstance->flush();
-               if (isset($GLOBALS['BE_USER'])) {
-                       $GLOBALS['BE_USER']->writelog(3, 1, 0, 0, '[StaticInfoTables]: User %s has cleared the class cache', array($GLOBALS['BE_USER']->user['username']));
-               }
-       }
+    /**
+     * Clear the class cache
+     *
+     * @return void
+     */
+    public function clear()
+    {
+        $this->cacheInstance->flush();
+        if (isset($GLOBALS['BE_USER'])) {
+            $GLOBALS['BE_USER']->writelog(3, 1, 0, 0, '[StaticInfoTables]: User %s has cleared the class cache', [$GLOBALS['BE_USER']->user['username']]);
+        }
+    }
 
-       /**
-        * Rebuild the class cache
-        *
-        * @return void
-        */
-       public function reBuild(array $parameters = array())
-       {
-               $isValidCall = (
-                       empty($parameters)
-                       || (
-                               !empty($parameters['cacheCmd'])
-                               && GeneralUtility::inList('all,temp_cached', $parameters['cacheCmd'])
-                               && isset($GLOBALS['BE_USER'])
-                       )
-               );
-               if ($isValidCall) {
-                       $this->clear();
-                       $this->clearReflectionCache();
-                       $this->build();
-               }
-       }
+    /**
+     * Rebuild the class cache
+     *
+     * @return void
+     */
+    public function reBuild(array $parameters = [])
+    {
+        $isValidCall = (
+            empty($parameters)
+            || (
+                !empty($parameters['cacheCmd'])
+                && GeneralUtility::inList('all,temp_cached', $parameters['cacheCmd'])
+                && isset($GLOBALS['BE_USER'])
+            )
+        );
+        if ($isValidCall) {
+            $this->clear();
+            $this->clearReflectionCache();
+            $this->build();
+        }
+    }
 
-       /**
-        * Drop the reflection cache
-        */
-       protected function clearReflectionCache()
-       {
-               if ($this->cacheManager->hasCache('extbase_reflection')) {
-                       $this->cacheManager->getCache('extbase_reflection')->flush();
-               }
-               if ($this->cacheManager->hasCache('extbase_datamapfactory_datamap')) {
-                       $this->cacheManager->getCache('extbase_datamapfactory_datamap')->flush();
-               }
-       }
-}
\ No newline at end of file
+    /**
+     * Drop the reflection cache
+     */
+    protected function clearReflectionCache()
+    {
+        if ($this->cacheManager->hasCache('extbase_reflection')) {
+            $this->cacheManager->getCache('extbase_reflection')->flush();
+        }
+        if ($this->cacheManager->hasCache('extbase_datamapfactory_datamap')) {
+            $this->cacheManager->getCache('extbase_datamapfactory_datamap')->flush();
+        }
+    }
+}
index 2163ebc..ae22d21 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 namespace SJBR\StaticInfoTables\Configuration\TypoScript;
+
 /***************************************************************
 *  Copyright notice
 *
@@ -27,93 +28,94 @@ namespace SJBR\StaticInfoTables\Configuration\TypoScript;
 ***************************************************************/
 /**
  * Class providing TypoScript configuration help for Static Info Tables
- *
  */
-class ConfigurationHelper {
-
-
-       /**
-        * @var \TYPO3\CMS\Extbase\Object\ObjectManager
-        */
-       protected $objectManager;
+class ConfigurationHelper
+{
+    /**
+     * @var \TYPO3\CMS\Extbase\Object\ObjectManager
+     */
+    protected $objectManager;
 
-       /**
-        * Renders a select element to select an entity
-        *
-        * @param array $params: Field information to be rendered
-        * @param \TYPO3\CMS\Core\TypoScript\ExtendedTemplateService $pObj: The calling parent object.
-        * @return string The HTML input field
-        */
-       public function buildEntitySelector(array $params, \TYPO3\CMS\Core\TypoScript\ExtendedTemplateService $pObj, $arg = '') {
-               $field = '';
-               $this->objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
-               switch ($params['fieldName']) {
-                       case 'data[plugin.tx_staticinfotables_pi1.countryCode]':
-                       case 'data[plugin.tx_staticinfotables_pi1.countriesAllowed]':
-                               $repository = $this->objectManager->get('SJBR\\StaticInfoTables\\Domain\\Repository\\CountryRepository');
-                               $entities = $repository->findAllOrderedBy('nameLocalized');
-                               break;
-                       case 'data[plugin.tx_staticinfotables_pi1.countryZoneCode]':
-                               $repository = $this->objectManager->get('SJBR\\StaticInfoTables\\Domain\\Repository\\CountryZoneRepository');
-                               $countryCode = $this->getConfiguredCountryCode();
-                               if ($countryCode) {
-                                       $countryRepository = $this->objectManager->get('SJBR\\StaticInfoTables\\Domain\\Repository\\CountryRepository');
-                                       $country = $countryRepository->findOneByIsoCodeA3($countryCode);
-                                       if (is_object($country)) {
-                                               $entities = $repository->findByCountryOrderedByLocalizedName($country);
-                                       }
-                               }
-                               if (!$countryCode || (empty($entities) && $params['fieldValue'])) {
-                                       $entities = $repository->findAllOrderedBy('nameLocalized');
-                               }
-                               break;
-                       case 'data[plugin.tx_staticinfotables_pi1.currencyCode]':
-                               $repository = $this->objectManager->get('SJBR\\StaticInfoTables\\Domain\\Repository\\CurrencyRepository');
-                               $entities = $repository->findAllOrderedBy('nameLocalized');
-                               break;
-                       case 'data[plugin.tx_staticinfotables_pi1.languageCode]':
-                               $repository = $this->objectManager->get('SJBR\\StaticInfoTables\\Domain\\Repository\\LanguageRepository');
-                               $entities = $repository->findAllNonConstructedNonSacred();
-                               $entities = $repository->localizedSort($entities);
-                               break;
-               }
-               if (is_array($entities) && count($entities)) {
-                       $options = array();
-                       foreach ($entities as $entity) {
-                               switch ($params['fieldName']) {
-                                       case 'data[plugin.tx_staticinfotables_pi1.countryZoneCode]':
-                                               $value = $entity->getIsoCode();
-                                               $options[] = array('name' => $entity->getNameLocalized() . ' (' . $value . ')', 'value' => $value);
-                                               break;
-                                       case 'data[plugin.tx_staticinfotables_pi1.countryCode]':
-                                       case 'data[plugin.tx_staticinfotables_pi1.countriesAllowed]':
-                                       case 'data[plugin.tx_staticinfotables_pi1.currencyCode]':
-                                               $value = $entity->getIsoCodeA3();
-                                               $options[] = array('name' => $entity->getNameLocalized() . ' (' . $value . ')', 'value' => $value);
-                                               break;
-                                       case 'data[plugin.tx_staticinfotables_pi1.languageCode]':
-                                               $countryCode = $entity->getCountryIsoCodeA2();
-                                               $value = $entity->getIsoCodeA2() . ($countryCode ? '_' . $countryCode : '');
-                                               $options[] = array('name' => $entity->getNameLocalized() . ' (' . $value . ')', 'value' => $value);
-                                               break;
-                               }
-                       }
-                       $outSelected = array();
-                       $size = $params['fieldName'] == 'data[plugin.tx_staticinfotables_pi1.countriesAllowed]' ? 5 : 1;
-                       $field = \SJBR\StaticInfoTables\Utility\HtmlElementUtility::selectConstructor($options, array($params['fieldValue']), $outSelected, $params['fieldName'], '', '', '', '', $size);
-               }
-               return $field;
-       }
+    /**
+     * Renders a select element to select an entity
+     *
+     * @param array $params: Field information to be rendered
+     * @param \TYPO3\CMS\Core\TypoScript\ExtendedTemplateService $pObj: The calling parent object.
+     * @param mixed $arg
+     *
+     * @return string The HTML input field
+     */
+    public function buildEntitySelector(array $params, \TYPO3\CMS\Core\TypoScript\ExtendedTemplateService $pObj, $arg = '')
+    {
+        $field = '';
+        $this->objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
+        switch ($params['fieldName']) {
+            case 'data[plugin.tx_staticinfotables_pi1.countryCode]':
+            case 'data[plugin.tx_staticinfotables_pi1.countriesAllowed]':
+                $repository = $this->objectManager->get('SJBR\\StaticInfoTables\\Domain\\Repository\\CountryRepository');
+                $entities = $repository->findAllOrderedBy('nameLocalized');
+                break;
+            case 'data[plugin.tx_staticinfotables_pi1.countryZoneCode]':
+                $repository = $this->objectManager->get('SJBR\\StaticInfoTables\\Domain\\Repository\\CountryZoneRepository');
+                $countryCode = $this->getConfiguredCountryCode();
+                if ($countryCode) {
+                    $countryRepository = $this->objectManager->get('SJBR\\StaticInfoTables\\Domain\\Repository\\CountryRepository');
+                    $country = $countryRepository->findOneByIsoCodeA3($countryCode);
+                    if (is_object($country)) {
+                        $entities = $repository->findByCountryOrderedByLocalizedName($country);
+                    }
+                }
+                if (!$countryCode || (empty($entities) && $params['fieldValue'])) {
+                    $entities = $repository->findAllOrderedBy('nameLocalized');
+                }
+                break;
+            case 'data[plugin.tx_staticinfotables_pi1.currencyCode]':
+                $repository = $this->objectManager->get('SJBR\\StaticInfoTables\\Domain\\Repository\\CurrencyRepository');
+                $entities = $repository->findAllOrderedBy('nameLocalized');
+                break;
+            case 'data[plugin.tx_staticinfotables_pi1.languageCode]':
+                $repository = $this->objectManager->get('SJBR\\StaticInfoTables\\Domain\\Repository\\LanguageRepository');
+                $entities = $repository->findAllNonConstructedNonSacred();
+                $entities = $repository->localizedSort($entities);
+                break;
+        }
+        if (is_array($entities) && count($entities)) {
+            $options = [];
+            foreach ($entities as $entity) {
+                switch ($params['fieldName']) {
+                    case 'data[plugin.tx_staticinfotables_pi1.countryZoneCode]':
+                        $value = $entity->getIsoCode();
+                        $options[] = ['name' => $entity->getNameLocalized() . ' (' . $value . ')', 'value' => $value];
+                        break;
+                    case 'data[plugin.tx_staticinfotables_pi1.countryCode]':
+                    case 'data[plugin.tx_staticinfotables_pi1.countriesAllowed]':
+                    case 'data[plugin.tx_staticinfotables_pi1.currencyCode]':
+                        $value = $entity->getIsoCodeA3();
+                        $options[] = ['name' => $entity->getNameLocalized() . ' (' . $value . ')', 'value' => $value];
+                        break;
+                    case 'data[plugin.tx_staticinfotables_pi1.languageCode]':
+                        $countryCode = $entity->getCountryIsoCodeA2();
+                        $value = $entity->getIsoCodeA2() . ($countryCode ? '_' . $countryCode : '');
+                        $options[] = ['name' => $entity->getNameLocalized() . ' (' . $value . ')', 'value' => $value];
+                        break;
+                }
+            }
+            $outSelected = [];
+            $size = $params['fieldName'] == 'data[plugin.tx_staticinfotables_pi1.countriesAllowed]' ? 5 : 1;
+            $field = \SJBR\StaticInfoTables\Utility\HtmlElementUtility::selectConstructor($options, [$params['fieldValue']], $outSelected, $params['fieldName'], '', '', '', '', $size);
+        }
+        return $field;
+    }
 
-       /**
-        * Gets the configured default country code
-        *
-        * @return string The configured default country code
-        */
-       protected function getConfiguredCountryCode () {
-               $configurationManager = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManager');
-               $settings = $configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
-               return $settings['plugin.']['tx_staticinfotables_pi1.']['countryCode'];
-       }
+    /**
+     * Gets the configured default country code
+     *
+     * @return string The configured default country code
+     */
+    protected function getConfiguredCountryCode()
+    {
+        $configurationManager = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManager');
+        $settings = $configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
+        return $settings['plugin.']['tx_staticinfotables_pi1.']['countryCode'];
+    }
 }
-?>
\ No newline at end of file
index c0b29e5..7d65acd 100644 (file)
@@ -45,282 +45,293 @@ use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
  */
 class ManagerController extends ActionController
 {
-       /**
-        * @var string Name of the extension this controller belongs to
-        */
-       protected $extensionName = 'StaticInfoTables';
+    /**
+     * @var string Name of the extension this controller belongs to
+     */
+    protected $extensionName = 'StaticInfoTables';
 
-       /**
-        * @var \SJBR\StaticInfoTables\Domain\Repository\CountryRepository
-        */
-       protected $countryRepository;
+    /**
+     * @var \SJBR\StaticInfoTables\Domain\Repository\CountryRepository
+     */
+    protected $countryRepository;
 
-       /**
-        * Dependency injection of the Country Repository
-        *
-        * @param \SJBR\StaticInfoTables\Domain\Repository\CountryRepository $countryRepository
-        * @return void
-        */
-       public function injectCountryRepository(\SJBR\StaticInfoTables\Domain\Repository\CountryRepository $countryRepository)
-       {
-               $this->countryRepository = $countryRepository;
-       }
+    /**
+     * Dependency injection of the Country Repository
+     *
+     * @param \SJBR\StaticInfoTables\Domain\Repository\CountryRepository $countryRepository
+     *
+     * @return void
+     */
+    public function injectCountryRepository(\SJBR\StaticInfoTables\Domain\Repository\CountryRepository $countryRepository)
+    {
+        $this->countryRepository = $countryRepository;
+    }
 
-       /**
-        * @var \SJBR\StaticInfoTables\Domain\Repository\CountryZoneRepository
-        */
-       protected $countryZoneRepository;
+    /**
+     * @var \SJBR\StaticInfoTables\Domain\Repository\CountryZoneRepository
+     */
+    protected $countryZoneRepository;
 
-       /**
-        * Dependency injection of the Country Zone Repository
-        *
-        * @param \SJBR\StaticInfoTables\Domain\Repository\CountryZoneRepository $countryZoneRepository
-        * @return void
-        */
-       public function injectCountryZoneRepository(\SJBR\StaticInfoTables\Domain\Repository\CountryZoneRepository $countryZoneRepository)
-       {
-               $this->countryZoneRepository = $countryZoneRepository;
-       }
+    /**
+     * Dependency injection of the Country Zone Repository
+     *
+     * @param \SJBR\StaticInfoTables\Domain\Repository\CountryZoneRepository $countryZoneRepository
+     *
+     * @return void
+     */
+    public function injectCountryZoneRepository(\SJBR\StaticInfoTables\Domain\Repository\CountryZoneRepository $countryZoneRepository)
+    {
+        $this->countryZoneRepository = $countryZoneRepository;
+    }
 
-       /**
-        * @var \SJBR\StaticInfoTables\Domain\Repository\CurrencyRepository
-        */
-       protected $currencyRepository;
+    /**
+     * @var \SJBR\StaticInfoTables\Domain\Repository\CurrencyRepository
+     */
+    protected $currencyRepository;
 
-       /**
-        * Dependency injection of the Currency Repository
-        *
-        * @param \SJBR\StaticInfoTables\Domain\Repository\CurrencyRepository $currencyRepository
-        * @return void
-        */
-       public function injectCurrencyRepository(\SJBR\StaticInfoTables\Domain\Repository\CurrencyRepository $currencyRepository)
-       {
-               $this->currencyRepository = $currencyRepository;
-       }
+    /**
+     * Dependency injection of the Currency Repository
+     *
+     * @param \SJBR\StaticInfoTables\Domain\Repository\CurrencyRepository $currencyRepository
+     *
+     * @return void
+     */
+    public function injectCurrencyRepository(\SJBR\StaticInfoTables\Domain\Repository\CurrencyRepository $currencyRepository)
+    {
+        $this->currencyRepository = $currencyRepository;
+    }
 
-       /**
-        * @var \SJBR\StaticInfoTables\Domain\Repository\LanguageRepository
-        */
-       protected $languageRepository;
+    /**
+     * @var \SJBR\StaticInfoTables\Domain\Repository\LanguageRepository
+     */
+    protected $languageRepository;
 
-       /**
-        * Dependency injection of the Language Repository
-        *
-        * @param \SJBR\StaticInfoTables\Domain\Repository\LanguageRepository $languageRepository
-        * @return void
-        */
-       public function injectLanguageRepository(\SJBR\StaticInfoTables\Domain\Repository\LanguageRepository $languageRepository)
-       {
-               $this->languageRepository = $languageRepository;
-       }
+    /**
+     * Dependency injection of the Language Repository
+     *
+     * @param \SJBR\StaticInfoTables\Domain\Repository\LanguageRepository $languageRepository
+     *
+     * @return void
+     */
+    public function injectLanguageRepository(\SJBR\StaticInfoTables\Domain\Repository\LanguageRepository $languageRepository)
+    {
+        $this->languageRepository = $languageRepository;
+    }
 
-       /**
-        * @var \SJBR\StaticInfoTables\Domain\Repository\TerritoryRepository
-        */
-       protected $territoryRepository;
+    /**
+     * @var \SJBR\StaticInfoTables\Domain\Repository\TerritoryRepository
+     */
+    protected $territoryRepository;
 
-       /**
-        * Dependency injection of the Territory Repository
-        *
-        * @param \SJBR\StaticInfoTables\Domain\Repository\TerritoryRepository $territoryRepository
-        * @return void
-        */
-       public function injectTerritoryRepository(\SJBR\StaticInfoTables\Domain\Repository\TerritoryRepository $territoryRepository)
-       {
-               $this->territoryRepository = $territoryRepository;
-       }
+    /**
+     * Dependency injection of the Territory Repository
+     *
+     * @param \SJBR\StaticInfoTables\Domain\Repository\TerritoryRepository $territoryRepository
+     *
+     * @return void
+     */
+    public function injectTerritoryRepository(\SJBR\StaticInfoTables\Domain\Repository\TerritoryRepository $territoryRepository)
+    {
+        $this->territoryRepository = $territoryRepository;
+    }
 
-       /**
-        * Display general information
-        *
-        * @return string An HTML display of data overview
-        */
-       public function informationAction()
-       {
-               $this->view->assign('actions',
-                       array(
-                               array(
-                                       'code' => 'newLanguagePack',
-                                       'title' => 'createLanguagePackTitle',
-                                       'description' => 'createLanguagePackDescription'
-                               ),
-                               array(
-                                       'code' => 'testForm',
-                                       'title' => 'testFormTitle',
-                                       'description' => 'testFormDescription'
-                               ),
-                               array(
-                                       'code' => 'sqlDumpNonLocalizedData',
-                                       'title' => 'sqlDumpNonLocalizedDataTitle',
-                                       'description' => 'sqlDumpNonLocalizedDataDescription'
-                               )
-                       )
-               );
-       }
+    /**
+     * Display general information
+     *
+     * @return string An HTML display of data overview
+     */
+    public function informationAction()
+    {
+        $this->view->assign(
+            'actions',
+            [
+                [
+                    'code' => 'newLanguagePack',
+                    'title' => 'createLanguagePackTitle',
+                    'description' => 'createLanguagePackDescription',
+                ],
+                [
+                    'code' => 'testForm',
+                    'title' => 'testFormTitle',
+                    'description' => 'testFormDescription',
+                ],
+                [
+                    'code' => 'sqlDumpNonLocalizedData',
+                    'title' => 'sqlDumpNonLocalizedDataTitle',
+                    'description' => 'sqlDumpNonLocalizedDataDescription',
+                ],
+            ]
+        );
+    }
 
-       /**
-        * Display the language pack creation form
-        *
-        * @param LanguagePack $languagePack
-        * @return string An HTML form for creating a language pack
-        */
-       public function newLanguagePackAction(LanguagePack $languagePack = null)
-       {
-               if (!is_object($languagePack)) {
-                       $languagePack = $this->objectManager->get(LanguagePack::class);
-               }
-               $languagePack->setVersion($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][GeneralUtility::camelCaseToLowerCaseUnderscored($this->extensionName)]['version']);
-               $languagePack->setAuthor($GLOBALS['BE_USER']->user['realName']);
-               $languagePack->setAuthorEmail($GLOBALS['BE_USER']->user['email']);
-               $localeUtility = $this->objectManager->get(LocaleUtility::class);
-               $this->view->assign('locales', $localeUtility->getLocales());
-               $this->view->assign('languagePack', $languagePack);
-       }
+    /**
+     * Display the language pack creation form
+     *
+     * @param LanguagePack $languagePack
+     *
+     * @return string An HTML form for creating a language pack
+     */
+    public function newLanguagePackAction(LanguagePack $languagePack = null)
+    {
+        if (!is_object($languagePack)) {
+            $languagePack = $this->objectManager->get(LanguagePack::class);
+        }
+        $languagePack->setVersion($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][GeneralUtility::camelCaseToLowerCaseUnderscored($this->extensionName)]['version']);
+        $languagePack->setAuthor($GLOBALS['BE_USER']->user['realName']);
+        $languagePack->setAuthorEmail($GLOBALS['BE_USER']->user['email']);
+        $localeUtility = $this->objectManager->get(LocaleUtility::class);
+        $this->view->assign('locales', $localeUtility->getLocales());
+        $this->view->assign('languagePack', $languagePack);
+    }
 
-       /**
-        * Creation/update a language pack for the Static Info Tables
-        *
-        * @param LanguagePack $languagePack
-        * @return string An HTML display of data overview
-        */
-       public function createLanguagePackAction(LanguagePack $languagePack)
-       {
-               // Add the localization columns
-               $locale = $languagePack->getLocale();
-               // Get the English name of the locale
-               $localeUtility = $this->objectManager->get(LocaleUtility::class);
-               $language = $localeUtility->getLanguageFromLocale($locale);
-               $languagePack->setLanguage($language);
-               $languagePack->setTypo3VersionRange($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][GeneralUtility::camelCaseToLowerCaseUnderscored($this->extensionName)]['constraints']['depends']['typo3']);
-               // If version is not set, use the version of the base extension
-               if (!$languagePack->getVersion()) {
-                       $languagePack->setVersion($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][GeneralUtility::camelCaseToLowerCaseUnderscored($this->extensionName)]['version']);
-               }
-               $this->countryRepository->addLocalizationColumns($locale);
-               $this->countryZoneRepository->addLocalizationColumns($locale);
-               $this->currencyRepository->addLocalizationColumns($locale);
-               $this->languageRepository->addLocalizationColumns($locale);
-               $this->territoryRepository->addLocalizationColumns($locale);
-               // Store the Language Pack
-               $languagePackRepository = $this->objectManager->get(LanguagePackRepository::class);
-               $messages = $languagePackRepository->writeLanguagePack($languagePack);
-               if (count($messages)) {
-                       foreach ($messages as $message) {
-                               $this->addFlashMessage($message, '', AbstractMessage::OK);
-                       }
-               }
-               $this->forward('information');
-       }
+    /**
+     * Creation/update a language pack for the Static Info Tables
+     *
+     * @param LanguagePack $languagePack
+     *
+     * @return string An HTML display of data overview
+     */
+    public function createLanguagePackAction(LanguagePack $languagePack)
+    {
+        // Add the localization columns
+        $locale = $languagePack->getLocale();
+        // Get the English name of the locale
+        $localeUtility = $this->objectManager->get(LocaleUtility::class);
+        $language = $localeUtility->getLanguageFromLocale($locale);
+        $languagePack->setLanguage($language);
+        $languagePack->setTypo3VersionRange($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][GeneralUtility::camelCaseToLowerCaseUnderscored($this->extensionName)]['constraints']['depends']['typo3']);
+        // If version is not set, use the version of the base extension
+        if (!$languagePack->getVersion()) {
+            $languagePack->setVersion($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][GeneralUtility::camelCaseToLowerCaseUnderscored($this->extensionName)]['version']);
+        }
+        $this->countryRepository->addLocalizationColumns($locale);
+        $this->countryZoneRepository->addLocalizationColumns($locale);
+        $this->currencyRepository->addLocalizationColumns($locale);
+        $this->languageRepository->addLocalizationColumns($locale);
+        $this->territoryRepository->addLocalizationColumns($locale);
+        // Store the Language Pack
+        $languagePackRepository = $this->objectManager->get(LanguagePackRepository::class);
+        $messages = $languagePackRepository->writeLanguagePack($languagePack);
+        if (count($messages)) {
+            foreach ($messages as $message) {
+                $this->addFlashMessage($message, '', AbstractMessage::OK);
+            }
+        }
+        $this->forward('information');
+    }
 
-       /**
-        * Display a test form
-        *
-        * @param Country $country
-        * @param CountryZone $countryZone
-        * @param Language $language
-        * @return string An HTML form
-        */
-       public function testFormAction(Country $country = null, CountryZone $countryZone = null, Language $language = null)
-       {
-               if (is_object($country) && (is_object($countryZone) || !$country->getCountryZones()->count())) {
-                       $this->forward('testFormResult', 'Manager', $this->extensionName, array('country' => $country, 'countryZone' => $countryZone, 'language' => $language));        
-               }
-               if (is_object($country)) {
-                       $this->view->assign('selectedCountry', $country);
-               }
-               if (is_object($countryZone)) {
-                       $this->view->assign('selectedCountryZone', $countryZone);
-               }
-               if (is_object($language)) {
-                       $this->view->assign('selectedLanguage', $language);
-               }
-       }
+    /**
+     * Display a test form
+     *
+     * @param Country $country
+     * @param CountryZone $countryZone
+     * @param Language $language
+     *
+     * @return string An HTML form
+     */
+    public function testFormAction(Country $country = null, CountryZone $countryZone = null, Language $language = null)
+    {
+        if (is_object($country) && (is_object($countryZone) || !$country->getCountryZones()->count())) {
+            $this->forward('testFormResult', 'Manager', $this->extensionName, ['country' => $country, 'countryZone' => $countryZone, 'language' => $language]);
+        }
+        if (is_object($country)) {
+            $this->view->assign('selectedCountry', $country);
+        }
+        if (is_object($countryZone)) {
+            $this->view->assign('selectedCountryZone', $countryZone);
+        }
+        if (is_object($language)) {
+            $this->view->assign('selectedLanguage', $language);
+        }
+    }
 
-       /**
-        * Display the test form result
-        *
-        * @param Country $country
-        * @param CountryZone $countryZone
-        * @param Language $language
-        * @return string HTML code presenting the localized data
-        */
-       public function testFormResultAction(Country $country = null, CountryZone $countryZone = null, Language $language = null)
-       {
-               $this->view->assign('country', $country);
-               $currencies = $this->currencyRepository->findByCountry($country);
-               if ($currencies->count()) {
-                       $this->view->assign('currency', $currencies[0]);
-               }
-               if (is_object($countryZone)) {
-                       $this->view->assign('countryZone', $countryZone);
-               }
-               $this->view->assign('language', $language);
-               $territories = $this->territoryRepository->findByCountry($country);
-               if ($territories->count()) {
-                       $this->view->assign('territory', $territories[0]);
-               }               
-       }
+    /**
+     * Display the test form result
+     *
+     * @param Country $country
+     * @param CountryZone $countryZone
+     * @param Language $language
+     *
+     * @return string HTML code presenting the localized data
+     */
+    public function testFormResultAction(Country $country = null, CountryZone $countryZone = null, Language $language = null)
+    {
+        $this->view->assign('country', $country);
+        $currencies = $this->currencyRepository->findByCountry($country);
+        if ($currencies->count()) {
+            $this->view->assign('currency', $currencies[0]);
+        }
+        if (is_object($countryZone)) {
+            $this->view->assign('countryZone', $countryZone);
+        }
+        $this->view->assign('language', $language);
+        $territories = $this->territoryRepository->findByCountry($country);
+        if ($territories->count()) {
+            $this->view->assign('territory', $territories[0]);
+        }
+    }
 
-       /**
-        * 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 = GeneralUtility::camelCaseToLowerCaseUnderscored($this->extensionName);
-               $extensionPath = ExtensionManagementUtility::extPath($extensionKey);
-               $filename = 'export-ext_tables_static+adt.sql';
-               GeneralUtility::writeFile($extensionPath . $filename, implode(LF, $dumpContent));
-               $message = LocalizationUtility::translate('sqlDumpCreated', $this->extensionName) . ' ' . $extensionPath . $filename;
-               $this->addFlashMessage($message, '', AbstractMessage::OK);
-               $this->forward('information');
-       }
+    /**
+     * 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 = [];
+        $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 = GeneralUtility::camelCaseToLowerCaseUnderscored($this->extensionName);
+        $extensionPath = ExtensionManagementUtility::extPath($extensionKey);
+        $filename = 'export-ext_tables_static+adt.sql';
+        GeneralUtility::writeFile($extensionPath . $filename, implode(LF, $dumpContent));
+        $message = LocalizationUtility::translate('sqlDumpCreated', $this->extensionName) . ' ' . $extensionPath . $filename;
+        $this->addFlashMessage($message, '', AbstractMessage::OK);
+        $this->forward('information');
+    }
 
-       /**
-        * Get the typo3-supported locale options for the language pack creation
-        *
-        * @return array An array of language objects
-        */
-       protected function getLocales()
-       {
-               $localeArray = array();
-               $locales = $this->objectManager->get(Locales::class);
-               $languages = $locales->getLanguages();
-               foreach ($languages as $locale => $language) {
-                       // No language pack for English
-                       if ($locale != 'default') {
-                               $languageObject = $this->objectManager->get(Language::class);
-                               $languageObject->setCollatingLocale($locale);
-                               $localizedLanguage = LocalizationUtility::translate('lang_' . $locale, 'Lang');
-                               $label = ($localizedLanguage ? $localizedLanguage : $language) . ' (' . $locale . ')';
-                               $languageObject->setNameEn($label);
-                               $localeArray[$label] = $languageObject;
-                       }
-               }
-               ksort($localeArray);
-               return $localeArray;
-       }
+    /**
+     * Get the typo3-supported locale options for the language pack creation
+     *
+     * @return array An array of language objects
+     */
+    protected function getLocales()
+    {
+        $localeArray = [];
+        $locales = $this->objectManager->get(Locales::class);
+        $languages = $locales->getLanguages();
+        foreach ($languages as $locale => $language) {
+            // No language pack for English
+            if ($locale != 'default') {
+                $languageObject = $this->objectManager->get(Language::class);
+                $languageObject->setCollatingLocale($locale);
+                $localizedLanguage = LocalizationUtility::translate('lang_' . $locale, 'Lang');
+                $label = ($localizedLanguage ? $localizedLanguage : $language) . ' (' . $locale . ')';
+                $languageObject->setNameEn($label);
+                $localeArray[$label] = $languageObject;
+            }
+        }
+        ksort($localeArray);
+        return $localeArray;
+    }
 
-       /**
-        * Get language name from locale
-        *
-        * @param string $locale
-        * @return string Language name
-        */
-       protected function getLanguageFromLocale($locale)
-       {
-               $locales = $this->objectManager->get(Locales::class);
-               $languages = $locales->getLanguages();
-               $language = $languages[$locale];
-               return $language . ' (' . $locale . ')';
-       }
-}
\ No newline at end of file
+    /**
+     * Get language name from locale
+     *
+     * @param string $locale
+     *
+     * @return string Language name
+     */
+    protected function getLanguageFromLocale($locale)
+    {
+        $locales = $this->objectManager->get(Locales::class);
+        $languages = $locales->getLanguages();
+        $language = $languages[$locale];
+        return $language . ' (' . $locale . ')';
+    }
+}
index 54af130..ff556b1 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 namespace SJBR\StaticInfoTables\Domain\Model;
+
 /***************************************************************
 *  Copyright notice
 *
@@ -26,89 +27,94 @@ namespace SJBR\StaticInfoTables\Domain\Model;
 /**
  * Abstract model for static entities
  */
+use SJBR\StaticInfoTables\Utility\LocalizationUtility;
 
-use \SJBR\StaticInfoTables\Utility\LocalizationUtility;
-
-class AbstractEntity extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
-
-       /**
-        * Name of the table from persistence mapping of this model
-        *
-        * @var string
-        */
-       protected $tableName = '';
+class AbstractEntity extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
+{
+    /**
+     * Name of the table from persistence mapping of this model
+     *
+     * @var string
+     */
+    protected $tableName = '';
 
-       /**
-        * Contains the persistence columns mapping of this model
-        *
-        * @var array
-        */
-       protected $columnsMapping = array();
+    /**
+     * Contains the persistence columns mapping of this model
+     *
+     * @var array
+     */
+    protected $columnsMapping = [];
 
-       /**
-        * @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
-        */
-       protected $objectManager;
+    /**
+     * @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
+     */
+    protected $objectManager;
 
-       /**
-        * On initialization, get the columns mapping configuration
-        */
-       public function initializeObject() {
-               $this->objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
-       }
+    /**
+     * On initialization, get the columns mapping configuration
+     */
+    public function initializeObject()
+    {
+        $this->objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
+    }
 
-       /**
-        * Localized name of the entity
-        * @var string
-        */
-       protected $nameLocalized = '';
+    /**
+     * Localized name of the entity
+     *
+     * @var string
+     */
+    protected $nameLocalized = '';
 
-       /**
-        * Sets the localized name of the entity
-        *
-        * @param string $nameLocalized
-        *
-        * @return void
-        */
-       public function setNameLocalized($nameLocalized) {
-               $this->nameLocalized = $nameLocalized;
-       }
+    /**
+     * Sets the localized name of the entity
+     *
+     * @param string $nameLocalized
+     *
+     * @return void
+     */
+    public function setNameLocalized($nameLocalized)
+    {
+        $this->nameLocalized = $nameLocalized;
+    }
 
-       /**
-        * Gets the localized name of the entity
-        *
-        * @return string
-        */
-       public function getNameLocalized() {
-               $language = LocalizationUtility::getCurrentLanguage();
-               $labelFields = LocalizationUtility::getLabelFields($this->tableName, $language);
-               foreach ($labelFields as $labelField) {
-                       if ($this->_hasProperty($this->columnsMapping[$labelField]['mapOnProperty'])) {
-                               $value = $this->_getProperty($this->columnsMapping[$labelField]['mapOnProperty']);
-                               if ($value) {
-                                       $this->nameLocalized = $value;
-                                       break;
-                               }
-                       }
-               }
-               return $this->nameLocalized;
-       }
+    /**
+     * Gets the localized name of the entity
+     *
+     * @return string
+     */
+    public function getNameLocalized()
+    {
+        $language = LocalizationUtility::getCurrentLanguage();
+        $labelFields = LocalizationUtility::getLabelFields($this->tableName, $language);
+        foreach ($labelFields as $labelField) {
+            if ($this->_hasProperty($this->columnsMapping[$labelField]['mapOnProperty'])) {
+                $value = $this->_getProperty($this->columnsMapping[$labelField]['mapOnProperty']);
+                if ($value) {
+                    $this->nameLocalized = $value;
+                    break;
+                }
+            }
+        }
+        return $this->nameLocalized;
+    }
 
-       /**
-        * Gets the table name
-        *
-        * @return string
-        */
-       public function getTableName() {
-               return $this->tableName;
-       }
+    /**
+     * Gets the table name
+     *
+     * @return string
+     */
+    public function getTableName()
+    {
+        return $this->tableName;
+    }
 
-       /**
-        * Gets the columns mapping
-        *
-        * @return string
-        */
-       public function getColumnsMapping() {
-               return $this->columnsMapping;
-       }
-}
\ No newline at end of file
+    /**
+     * Gets the columns mapping
+     *
+     * @return string
+     */
+    public function getColumnsMapping()
+    {
+        return $this->columnsMapping;
+    }
+}
index 6032731..8b85e87 100644 (file)
@@ -34,531 +34,586 @@ use TYPO3\CMS\Extbase\Annotation\ORM\Lazy;
  */
 class Country extends AbstractEntity
 {
-       /**
-        * @var string
-        */
-       protected $addressFormat = '';
-
-       /**
-        * @var string
-        */
-       protected $capitalCity = '';
-
-       /**
-        * Country zones of this country
-        *
-        * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\SJBR\StaticInfoTables\Domain\Model\CountryZone>
-        * @Lazy
-        * @lazy
-        */
-       protected $countryZones;
-
-       /**
-        * Currency code as number (i.e. 978)
-        * ISO 4217 Nr Currency code
-        * @var integer
-        */
-       protected $currencyIsoCodeNumber = 0;
-
-       /**
-        * Currency code as three digit string (i.e. EUR)
-        * ISO 4217 A3 Currency code
-        * @var string
-        */
-       protected $currencyIsoCodeA3 = '';
-
-       /**
-        * Deletion status of the object
-        * @var boolean
-        */
-       protected $deleted = FALSE;
-
-       /**
-        * Whether or not the country is a member of the European Union
-        * @var boolean
-        */
-       protected $euMember = FALSE;
-
-       /**
-        * Country code as two digit string (i.e. AT)
-        * ISO 3166-1 A2 Country code
-        * @var string
-        */
-       protected $isoCodeA2 = '';
-
-       /**
-        * Country code as three digit string (i.e. AUT)
-        * ISO 3166-1 A3 Country code
-        * @var string
-        */
-       protected $isoCodeA3 = '';
-
-       /**
-        * Country code as number (i.e. 40)
-        * ISO 3166-1 Nr Country code
-        * @var integer
-        */
-       protected $isoCodeNumber = 0;
-
-       /**
-        * The official name of the country in English
-        * @var string
-        */
-       protected $officialNameEn = '';
-
-       /**
-        * The official name of the country in local language and local script
-        * @var string
-        */
-       protected $officialNameLocal = '';
-
-       /**
-        * UN number of territory in which the country is located
-        * @var integer
-        */
-       protected $parentTerritoryUnCodeNumber = 0;
-
-       /**
-        * The international phone prefix for the country
-        * @var integer
-        */
-       protected $phonePrefix = 0;
-
-       /**
-        * @var string
-        */
-       protected $shortNameEn = '';
-
-       /**
-        * @var string
-        */
-       protected $shortNameLocal = '';
-
-       /**
-        * Whether the country is a member of the UNO or not
-        * @var boolean
-        */
-       protected $unMember = FALSE;
-
-       /**
-        * The Internet top level domain of the country
-        * @var string
-        */
-       protected $topLevelDomain = '';
-
-       /**
-        * @var boolean
-        */
-       protected $zoneFlag = FALSE;
-
-       /**
-        * On initialization, get the columns mapping configuration
-        */
-       public function initializeObject() {
-               parent::initializeObject();
-               $this->tableName = ModelUtility::getModelMapping('SJBR\\StaticInfoTables\\Domain\\Model\\Country', ModelUtility::MAPPING_TABLENAME);
-               $this->columnsMapping = ModelUtility::getModelMapping('SJBR\\StaticInfoTables\\Domain\\Model\\Country', ModelUtility::MAPPING_COLUMNS);
-               $this->countryZones = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage');
-       }
-
-       /**
-        * Sets the address format.
-        *
-        * @param string $addressFormat
-        *
-        * @return void
-        */
-       public function setAddressFormat($addressFormat) {
-               $this->addressFormat = $addressFormat;
-       }
-
-       /**
-        * Gets the address format.
-        *
-        * @return string
-        */
-       public function getAddressFormat() {
-               return $this->addressFormat;
-       }
-
-       /**
-        * Sets the name of the capital city
-        *
-        * @param string $capitalCity
-        *
-        * @return void
-        */
-       public function setCapitalCity($capitalCity) {
-               $this->capitalCity = $capitalCity;
-       }
-
-       /**
-        * Gets the name of the capital city
-        *
-        * @return string
-        */
-       public function getCapitalCity() {
-               return $this->capitalCity;
-       }
-
-       /**
-        * Sets the ISO A3 currency code.
-        *
-        * @param string $currencyIsoCodeA3
-        *
-        * @return void
-        */
-       public function setCurrencyIsoCodeA3($currencyIsoCodeA3) {
-               $this->currencyIsoCodeA3 = $currencyIsoCodeA3;
-       }
-
-       /**
-        * Gets the ISO A3 currency code.
-        *
-        * @return string
-        */
-       public function getCurrencyIsoCodeA3() {
-               return $this->currencyIsoCodeA3;
-       }
-
-       /**
-        * Sets the ISO numeric currency code
-        *
-        * @param integer $currencyIsoCodeNumber
-        *
-        * @return void
-        */
-       public function setCurrencyIsoCodeNumber($currencyIsoCodeNumber) {
-               $this->currencyIsoCodeNumber = $currencyIsoCodeNumber;
-       }
-
-       /**
-        * Gets the ISO numeric currency code
-        *
-        * @return integer
-        */
-       public function getCurrencyIsoCodeNumber() {
-               return $this->currencyIsoCodeNumber;
-       }
-
-       /**
-        * Sets whether this country is a member of the European Union.
-        *
-        * @param boolean $euMember
-        *
-        * @return void
-        */
-       public function setEuMember($euMember) {
-               $this->euMember = $euMember;
-       }
-
-       /**
-        * Gets the deletion status of the entity
-        *
-        * @return boolean
-        */
-       public function getDeleted() {
-               return $this->deleted;
-       }
-
-       /**
-        * Sets the deletion status of the entity
-        *
-        * @param boolean $deleted
-        * @return void
-        */
-       public function setDeleted($deleted) {
-               return $this->deleted = $deleted;
-       }
-
-       /**
-        * Gets whether this country is a member of the European Union.
-        *
-        * @return boolean
-        */
-       public function getEuMember() {
-               return $this->euMember;
-       }
-
-       /**
-        * Gets whether this country is a member of the European Union.
-        *
-        * This method is a synonym for the getEuMember method.
-        *
-        * @return boolean
-        */
-       public function isEuMember() {
-               return $this->getEuMember();
-       }
-
-       /**
-        * Sets the ISO alpha-2 code.
-        *
-        * @param string $isoCodeA2
-        *
-        * @return void
-        */
-       public function setIsoCodeA2($isoCodeA2) {
-               $this->isoCodeA2 = $isoCodeA2;
-       }
-
-       /**
-        * Gets the ISO alpha-2 code.
-        *
-        * @return string
-        */
-       public function getIsoCodeA2() {
-               return $this->isoCodeA2;
-       }
-
-       /**
-        * Sets the ISO alpha-3 code.
-        *
-        * @param string $isoCodeA3
-        *
-        * @return void
-        */
-       public function setIsoCodeA3($isoCodeA3) {
-               $this->isoCodeA3 = $isoCodeA3;
-       }
-
-       /**
-        * Gets the ISO alpha-3 code.
-        *
-        * @return string
-        */
-       public function getIsoCodeA3() {
-               return $this->isoCodeA3;
-       }
-
-       /**
-        * Sets the ISO code number.
-        *
-        * @param integer $isoCodeNumber
-        *
-        * @return void
-        */
-       public function setIsoCodeNumber($isoCodeNumber) {
-               $this->isoCodeNumber = $isoCodeNumber;
-       }
-
-       /**
-        * Gets the ISO code number.
-        *
-        * @return integer
-        */
-       public function getIsoCodeNumber() {
-               return $this->isoCodeNumber;
-       }
-
-       /**
-        * Sets the official name of the country in English
-        *
-        * @param string $officialNameEn
-        *
-        * @return void
-        */
-       public function setOfficialNameEn($officialNameEn) {
-               $this->officialNameEn = $officialNameEn;
-       }
-
-       /**
-        * Gets the official name of the country in English
-        *
-        * @return string
-        */
-       public function getOfficialNameEn() {
-               return $this->officialNameEn;
-       }
-
-       /**
-        * Sets the official name of the country in local language and script
-        *
-        * @param string $officialNameLocal
-        *
-        * @return void
-        */
-       public function setOfficialNameLocal($officialNameLocal) {
-               $this->officialNameLocal = $officialNameLocal;
-       }
-
-       /**
-        * Gets the official name of the country in local language and script
-        *
-        * @return string
-        */
-       public function getOfficialNameLocal() {
-               return $this->officialNameLocal;
-       }
-
-       /**
-        * Sets the parent territory UN numeric code.
-        *
-        * @param integer $parentTerritoryUnCodeNumber
-        *
-        * @return void
-        */
-       public function setParentTerritoryUnCodeNumber($parentTerritoryUnCodeNumber) {
-               $this->parentTerritoryUnCodeNumber = $parentTerritoryUnCodeNumber;
-       }
-
-       /**
-        * Gets the parent territory UN numeric code.
-        *
-        * @return integer
-        */
-       public function getParentTerritoryUnCodeNumber() {
-               return $this->parentTerritoryUnCodeNumber;
-       }
-
-       /**
-        * Sets the phone prefix.
-        *
-        * @param integer $phonePrefix
-        *
-        * @return void
-        */
-       public function setPhonePrefix($phonePrefix) {
-               $this->phonePrefix = $phonePrefix;
-       }
-
-       /**
-        * Gets the phone prefix.
-        *
-        * @return integer
-        */
-       public function getPhonePrefix() {
-               return $this->phonePrefix;
-       }
-
-       /**
-        * Sets the English short name.
-        *
-        * @param string $shortNameEn
-        *
-        * @return void
-        */
-       public function setShortNameEn($shortNameEn) {
-               $this->shortNameEn = $shortNameEn;
-       }
-
-       /**
-        * Gets the English short name.
-        *
-        * @return string
-        */
-       public function getShortNameEn() {
-               return $this->shortNameEn;
-       }
-
-       /**
-        * Sets the short local name.
-        *
-        * @param string $shortNameLocal
-        *
-        * @return void
-        */
-       public function setShortNameLocal($shortNameLocal) {
-               $this->shortNameLocal = $shortNameLocal;
-       }
-
-       /**
-        * Gets the short local name.
-        *
-        * @return string
-        */
-       public function getShortNameLocal() {
-               return $this->shortNameLocal;
-       }
-
-       /**
-        * Sets the top-level domain.
-        *
-        * @param string $topLevelDomain
-        *
-        * @return void
-        */
-       public function setTopLevelDomain($topLevelDomain) {
-               $this->topLevelDomain = $topLevelDomain;
-       }
-
-       /**
-        * Gets the top-level domain.
-        *
-        * @return string
-        */
-       public function getTopLevelDomain() {
-               return $this->topLevelDomain;
-       }
-
-       /**
-        * Sets whether this country is a member of the United Nations.
-        *
-        * @param boolean $unMember
-        *
-        * @return void
-        */
-       public function setUnMember($unMember) {
-               $this->unMember = $unMember;
-       }
-
-       /**
-        * Gets whether this country is a member of the United Nations.
-        *
-        * @return boolean
-        */
-       public function getUnMember() {
-               return $this->unMember;
-       }
-
-       /**
-        * Sets whether this country is a member of the United Nations.
-        *
-        * This method is a synonym for the getUnMember method.
-        *
-        * @return boolean
-        */
-       public function isUnMember() {
-               return $this->getUnMember();
-       }
-
-       /**
-        * Sets the zone flag.
-        *
-        * @param boolean $zoneFlag
-        *
-        * @return void
-        */
-       public function setZoneFlag($zoneFlag) {
-               $this->zoneFlag = $zoneFlag;
-       }
-
-       /**
-        * Gets the zone flag.
-        *
-        * @return boolean
-        */
-       public function getZoneFlag() {
-               return $this->zoneFlag;
-       }
-
-       /**
-        * Sets the country zones
-        *
-        * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\SJBR\StaticInfoTables\Domain\Model\CountryZone> $countryZones
-        *
-        * @return void
-        */
-       public function setCountryZones($countryZones) {
-               $this->countryZones = $countryZones;
-       }
-
-       /**
-        * Gets the country zones
-        *
-        * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\SJBR\StaticInfoTables\Domain\Model\CountryZone> $countryZones
-        */
-       public function getCountryZones() {
-               return $this->countryZones;
-       }
-}
\ No newline at end of file
+    /**
+     * @var string
+     */
+    protected $addressFormat = '';
+
+    /**
+     * @var string
+     */
+    protected $capitalCity = '';
+
+    /**
+     * Country zones of this country
+     *
+     * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\SJBR\StaticInfoTables\Domain\Model\CountryZone>
+     * @Lazy
+     * @lazy
+     */
+    protected $countryZones;
+
+    /**
+     * Currency code as number (i.e. 978)
+     * ISO 4217 Nr Currency code
+     *
+     * @var int
+     */
+    protected $currencyIsoCodeNumber = 0;
+
+    /**
+     * Currency code as three digit string (i.e. EUR)
+     * ISO 4217 A3 Currency code
+     *
+     * @var string
+     */
+    protected $currencyIsoCodeA3 = '';
+
+    /**
+     * Deletion status of the object
+     *
+     * @var bool
+     */
+    protected $deleted = false;
+
+    /**
+     * Whether or not the country is a member of the European Union
+     *
+     * @var bool
+     */
+    protected $euMember = false;
+
+    /**
+     * Country code as two digit string (i.e. AT)
+     * ISO 3166-1 A2 Country code
+     *
+     * @var string
+     */
+    protected $isoCodeA2 = '';
+
+    /**
+     * Country code as three digit string (i.e. AUT)
+     * ISO 3166-1 A3 Country code
+     *
+     * @var string
+     */
+    protected $isoCodeA3 = '';
+
+    /**
+     * Country code as number (i.e. 40)
+     * ISO 3166-1 Nr Country code
+     *
+     * @var int
+     */
+    protected $isoCodeNumber = 0;
+
+    /**
+     * The official name of the country in English
+     *
+     * @var string
+     */
+    protected $officialNameEn = '';
+
+    /**
+     * The official name of the country in local language and local script
+     *
+     * @var string
+     */
+    protected $officialNameLocal = '';
+
+    /**
+     * UN number of territory in which the country is located
+     *
+     * @var int
+     */
+    protected $parentTerritoryUnCodeNumber = 0;
+
+    /**
+     * The international phone prefix for the country
+     *
+     * @var int
+     */
+    protected $phonePrefix = 0;
+
+    /**
+     * @var string
+     */
+    protected $shortNameEn = '';
+
+    /**
+     * @var string
+     */
+    protected $shortNameLocal = '';
+
+    /**
+     * Whether the country is a member of the UNO or not
+     *
+     * @var bool
+     */
+    protected $unMember = false;
+
+    /**
+     * The Internet top level domain of the country
+     *
+     * @var string
+     */
+    protected $topLevelDomain = '';
+
+    /**
+     * @var bool
+     */
+    protected $zoneFlag = false;
+
+    /**
+     * On initialization, get the columns mapping configuration
+     */
+    public function initializeObject()
+    {
+        parent::initializeObject();
+        $this->tableName = ModelUtility::getModelMapping('SJBR\\StaticInfoTables\\Domain\\Model\\Country', ModelUtility::MAPPING_TABLENAME);
+        $this->columnsMapping = ModelUtility::getModelMapping('SJBR\\StaticInfoTables\\Domain\\Model\\Country', ModelUtility::MAPPING_COLUMNS);
+        $this->countryZones = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage');
+    }
+
+    /**
+     * Sets the address format.
+     *
+     * @param string $addressFormat
+     *
+     * @return void
+     */
+    public function setAddressFormat($addressFormat)
+    {
+        $this->addressFormat = $addressFormat;
+    }
+
+    /**
+     * Gets the address format.
+     *
+     * @return string
+     */
+    public function getAddressFormat()
+    {
+        return $this->addressFormat;
+    }
+
+    /**
+     * Sets the name of the capital city
+     *
+     * @param string $capitalCity
+     *
+     * @return void
+     */
+    public function setCapitalCity($capitalCity)
+    {
+        $this->capitalCity = $capitalCity;
+    }
+
+    /**
+     * Gets the name of the capital city
+     *
+     * @return string
+     */
+    public function getCapitalCity()
+    {
+        return $this->capitalCity;
+    }
+
+    /**
+     * Sets the ISO A3 currency code.
+     *
+     * @param string $currencyIsoCodeA3
+     *
+     * @return void
+     */
+    public function setCurrencyIsoCodeA3($currencyIsoCodeA3)
+    {
+        $this->currencyIsoCodeA3 = $currencyIsoCodeA3;
+    }
+
+    /**
+     * Gets the ISO A3 currency code.
+     *
+     * @return string
+     */
+    public function getCurrencyIsoCodeA3()
+    {
+        return $this->currencyIsoCodeA3;
+    }
+
+    /**
+     * Sets the ISO numeric currency code
+     *
+     * @param int $currencyIsoCodeNumber
+     *
+     * @return void
+     */
+    public function setCurrencyIsoCodeNumber($currencyIsoCodeNumber)
+    {
+        $this->currencyIsoCodeNumber = $currencyIsoCodeNumber;
+    }
+
+    /**
+     * Gets the ISO numeric currency code
+     *
+     * @return int
+     */
+    public function getCurrencyIsoCodeNumber()
+    {
+        return $this->currencyIsoCodeNumber;
+    }
+
+    /**
+     * Sets whether this country is a member of the European Union.
+     *
+     * @param bool $euMember
+     *
+     * @return void
+     */
+    public function setEuMember($euMember)
+    {
+        $this->euMember = $euMember;
+    }
+
+    /**
+     * Gets the deletion status of the entity
+     *
+     * @return bool
+     */
+    public function getDeleted()
+    {
+        return $this->deleted;
+    }
+
+    /**
+     * Sets the deletion status of the entity
+     *
+     * @param bool $deleted
+     *
+     * @return void
+     */
+    public function setDeleted($deleted)
+    {
+        return $this->deleted = $deleted;
+    }
+
+    /**
+     * Gets whether this country is a member of the European Union.
+     *
+     * @return bool
+     */
+    public function getEuMember()
+    {
+        return $this->euMember;
+    }
+
+    /**
+     * Gets whether this country is a member of the European Union.
+     *
+     * This method is a synonym for the getEuMember method.
+     *
+     * @return bool
+     */
+    public function isEuMember()
+    {
+        return $this->getEuMember();
+    }
+
+    /**
+     * Sets the ISO alpha-2 code.
+     *
+     * @param string $isoCodeA2
+     *
+     * @return void
+     */
+    public function setIsoCodeA2($isoCodeA2)
+    {
+        $this->isoCodeA2 = $isoCodeA2;
+    }
+
+    /**
+     * Gets the ISO alpha-2 code.
+     *
+     * @return string
+     */
+    public function getIsoCodeA2()
+    {
+        return $this->isoCodeA2;
+    }
+
+    /**
+     * Sets the ISO alpha-3 code.
+     *
+     * @param string $isoCodeA3
+     *
+     * @return void
+     */
+    public function setIsoCodeA3($isoCodeA3)
+    {
+        $this->isoCodeA3 = $isoCodeA3;
+    }
+
+    /**
+     * Gets the ISO alpha-3 code.
+     *
+     * @return string
+     */
+    public function getIsoCodeA3()
+    {
+        return $this->isoCodeA3;
+    }
+
+    /**
+     * Sets the ISO code number.
+     *
+     * @param int $isoCodeNumber
+     *
+     * @return void
+     */
+    public function setIsoCodeNumber($isoCodeNumber)
+    {
+        $this->isoCodeNumber = $isoCodeNumber;
+    }
+
+    /**
+     * Gets the ISO code number.
+     *
+     * @return int
+     */
+    public function getIsoCodeNumber()
+    {
+        return $this->isoCodeNumber;
+    }
+
+    /**
+     * Sets the official name of the country in English
+     *
+     * @param string $officialNameEn
+     *
+     * @return void
+     */
+    public function setOfficialNameEn($officialNameEn)
+    {
+        $this->officialNameEn = $officialNameEn;
+    }
+
+    /**
+     * Gets the official name of the country in English
+     *
+     * @return string
+     */
+    public function getOfficialNameEn()
+    {
+        return $this->officialNameEn;
+    }
+
+    /**
+     * Sets the official name of the country in local language and script
+     *
+     * @param string $officialNameLocal
+     *
+     * @return void
+     */
+    public function setOfficialNameLocal($officialNameLocal)
+    {
+        $this->officialNameLocal = $officialNameLocal;
+    }
+
+    /**
+     * Gets the official name of the country in local language and script
+     *
+     * @return string
+     */
+    public function getOfficialNameLocal()
+    {
+        return $this->officialNameLocal;
+    }
+
+    /**
+     * Sets the parent territory UN numeric code.
+     *
+     * @param int $parentTerritoryUnCodeNumber
+     *
+     * @return void
+     */
+    public function setParentTerritoryUnCodeNumber($parentTerritoryUnCodeNumber)
+    {
+        $this->parentTerritoryUnCodeNumber = $parentTerritoryUnCodeNumber;
+    }
+
+    /**
+     * Gets the parent territory UN numeric code.
+     *
+     * @return int
+     */
+    public function getParentTerritoryUnCodeNumber()
+    {
+        return $this->parentTerritoryUnCodeNumber;
+    }
+
+    /**
+     * Sets the phone prefix.
+     *
+     * @param int $phonePrefix
+     *
+     * @return void
+     */
+    public function setPhonePrefix($phonePrefix)
+    {
+        $this->phonePrefix = $phonePrefix;
+    }
+
+    /**
+     * Gets the phone prefix.
+     *
+     * @return int
+     */
+    public function getPhonePrefix()
+    {
+        return $this->phonePrefix;
+    }
+
+    /**
+     * Sets the English short name.
+     *
+     * @param string $shortNameEn
+     *
+     * @return void
+     */
+    public function setShortNameEn($shortNameEn)
+    {
+        $this->shortNameEn = $shortNameEn;
+    }
+
+    /**
+     * Gets the English short name.
+     *
+     * @return string
+     */
+    public function getShortNameEn()
+    {
+        return $this->shortNameEn;
+    }
+
+    /**
+     * Sets the short local name.
+     *
+     * @param string $shortNameLocal
+     *
+     * @return void
+     */
+    public function setShortNameLocal($shortNameLocal)
+    {
+        $this->shortNameLocal = $shortNameLocal;
+    }
+
+    /**
+     * Gets the short local name.
+     *
+     * @return string
+     */
+    public function getShortNameLocal()
+    {
+        return $this->shortNameLocal;
+    }
+
+    /**
+     * Sets the top-level domain.
+     *
+     * @param string $topLevelDomain
+     *
+     * @return void
+     */
+    public function setTopLevelDomain($topLevelDomain)
+    {
+        $this->topLevelDomain = $topLevelDomain;
+    }
+
+    /**
+     * Gets the top-level domain.
+     *
+     * @return string
+     */
+    public function getTopLevelDomain()
+    {
+        return $this->topLevelDomain;
+    }
+
+    /**
+     * Sets whether this country is a member of the United Nations.
+     *
+     * @param bool $unMember
+     *
+     * @return void
+     */
+    public function setUnMember($unMember)
+    {
+        $this->unMember = $unMember;
+    }
+
+    /**
+     * Gets whether this country is a member of the United Nations.
+     *
+     * @return bool
+     */
+    public function getUnMember()
+    {
+        return $this->unMember;
+    }
+
+    /**
+     * Sets whether this country is a member of the United Nations.
+     *
+     * This method is a synonym for the getUnMember method.
+     *
+     * @return bool
+     */
+    public function isUnMember()
+    {
+        return $this->getUnMember();
+    }
+
+    /**
+     * Sets the zone flag.
+     *
+     * @param bool $zoneFlag
+     *
+     * @return void
+     */
+    public function setZoneFlag($zoneFlag)
+    {
+        $this->zoneFlag = $zoneFlag;
+    }
+
+    /**
+     * Gets the zone flag.
+     *
+     * @return bool
+     */
+    public function getZoneFlag()
+    {
+        return $this->zoneFlag;
+    }
+
+    /**
+     * Sets the country zones
+     *
+     * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\SJBR\StaticInfoTables\Domain\Model\CountryZone> $countryZones
+     *
+     * @return void
+     */
+    public function setCountryZones($countryZones)
+    {
+        $this->countryZones = $countryZones;
+    }
+
+    /**
+     * Gets the country zones
+     *
+     * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\SJBR\StaticInfoTables\Domain\Model\CountryZone> $countryZones
+     */
+    public function getCountryZones()
+    {
+        return $this->countryZones;
+    }
+}
index 61837c4..993f2b4 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 namespace SJBR\StaticInfoTables\Domain\Model;
+
 /***************************************************************
 *  Copyright notice
 *
@@ -30,204 +31,227 @@ namespace SJBR\StaticInfoTables\Domain\Model;
  * @copyright Copyright belongs to the respective authors
  * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 or later
  */
-
 use SJBR\StaticInfoTables\Utility\ModelUtility;
 
-class CountryZone extends AbstractEntity {
-       /**
-        * Country code as two digit string (i.e. AT)
-        * ISO 3166-1 A2 Country code
-        * @var string
-        */
-       protected $countryIsoCodeA2 = '';
-
-       /**
-        * Country code as three digit string (i.e. AUT)
-        * ISO 3166-1 A3 Country code
-        * @var string
-        */
-       protected $countryIsoCodeA3 = '';
-
-       /**
-        * Country code as number (i.e. 40)
-        * ISO 3166-1 Nr Country code
-        * @var integer
-        */
-       protected $countryIsoCodeNumber = 0;
-
-       /**
-        * Deletion status of the object
-        * @var boolean
-        */
-       protected $deleted = FALSE;
-
-       /**
-        * Country zone code as string
-        * ISO 3166-2 Country Zone code
-        * @var string
-        */
-       protected $isoCode = '';
-
-       /**
-        * Local name of the country zone
-        * @var string
-        */
-       protected $localName = '';
-
-       /**
-        * English name of the country zone
-        * @var string
-        */
-       protected $nameEn = '';
-
-       /**
-        * On initialization, get the columns mapping configuration
-        */
-       public function initializeObject() {
-               parent::initializeObject();
-               $this->tableName = ModelUtility::getModelMapping('SJBR\\StaticInfoTables\\Domain\\Model\\CountryZone', ModelUtility::MAPPING_TABLENAME);
-               $this->columnsMapping = ModelUtility::getModelMapping('SJBR\\StaticInfoTables\\Domain\\Model\\CountryZone', ModelUtility::MAPPING_COLUMNS);
-       }
-
-       /**
-        * Sets the country ISO alpha-2 code.
-        *
-        * @param string $countryIsoCodeA2
-        *
-        * @return void
-        */
-       public function setCountryIsoCodeA2($countryIsoCodeA2) {
-               $this->countryIsoCodeA2 = $countryIsoCodeA2;
-       }
-
-       /**
-        * Gets the country ISO alpha-2 code.
-        *
-        * @return string
-        */
-       public function getCountryIsoCodeA2() {
-               return $this->countryIsoCodeA2;
-       }
-
-       /**
-        * Sets the country ISO alpha-3 code.
-        *
-        * @param string $countryIsoCodeA3
-        *
-        * @return void
-        */
-       public function setCountryIsoCodeA3($countryIsoCodeA3) {
-               $this->countryIsoCodeA3 = $countryIsoCodeA3;
-       }
-
-       /**
-        * Gets the country ISO alpha-3 code.
-        *
-        * @return string
-        */
-       public function getCountryIsoCodeA3() {
-               return $this->countryIsoCodeA3;
-       }
-
-       /**
-        * Sets the country numeric ISO code
-        *
-        * @param integer $countryIsoCodeNumber
-        *
-        * @return void
-        */
-       public function setCountryIsoCodeNumber($countryIsoCodeNumber) {
-               $this->countryIsoCodeNumber = $countryIsoCodeNumber;
-       }
-
-       /**
-        * Gets the country numeric ISO code
-        *
-        * @return integer
-        */
-       public function getCountryIsoCodeNumber() {
-               return $this->countryIsoCodeNumber;
-       }
-
-       /**
-        * Gets the deletion status of the entity
-        *
-        * @return boolean
-        */
-       public function getDeleted() {
-               return $this->deleted;
-       }
-
-       /**
-        * Sets the deletion status of the entity
-        *
-        * @param boolean $deleted
-        * @return void
-        */
-       public function setDeleted($deleted) {
-               return $this->deleted = $deleted;
-       }
-
-       /**
-        * Sets the country zone ISO code.
-        *
-        * @param string $isoCode
-        *
-        * @return void
-        */
-       public function setIsoCode($isoCode) {
-               $this->isoCode = $isoCode;
-       }
-
-       /**
-        * Gets the country zone ISO code.
-        *
-        * @return string
-        */
-       public function getIsoCode() {
-               return $this->isoCode;
-       }
-
-       /**
-        * Sets the local name.
-        *
-        * @param string $localName
-        *
-        * @return void
-        */
-       public function setLocalName($localName) {
-               $this->localName = $localName;
-       }
-
-       /**
-        * Gets the local name.
-        *
-        * @return string
-        */
-       public function getLocalName() {
-               return $this->localName;
-       }
-
-       /**
-        * Sets the English name.
-        *
-        * @param string $nameEn
-        *
-        * @return void
-        */
-       public function setNameEn($nameEn) {
-               $this->nameEn = $nameEn;
-       }
-
-       /**
-        * Returns English name. If empty returns the localName.
-        *
-        * @return string
-        */
-       public function getNameEn() {
-               if ($this->nameEn === '') {
-                       return $this->getLocalName();
-               }
-               return $this->nameEn;
-       }
-}
\ No newline at end of file
+class CountryZone extends AbstractEntity
+{
+    /**
+     * Country code as two digit string (i.e. AT)
+     * ISO 3166-1 A2 Country code
+     *
+     * @var string
+     */
+    protected $countryIsoCodeA2 = '';
+
+    /**
+     * Country code as three digit string (i.e. AUT)
+     * ISO 3166-1 A3 Country code
+     *
+     * @var string
+     */
+    protected $countryIsoCodeA3 = '';
+
+    /**
+     * Country code as number (i.e. 40)
+     * ISO 3166-1 Nr Country code
+     *
+     * @var int
+     */
+    protected $countryIsoCodeNumber = 0;
+
+    /**
+     * Deletion status of the object
+     *
+     * @var bool
+     */
+    protected $deleted = false;
+
+    /**
+     * Country zone code as string
+     * ISO 3166-2 Country Zone code
+     *
+     * @var string
+     */
+    protected $isoCode = '';
+
+    /**
+     * Local name of the country zone
+     *
+     * @var string
+     */
+    protected $localName = '';
+
+    /**
+     * English name of the country zone
+     *
+     * @var string
+     */
+    protected $nameEn = '';
+
+    /**
+     * On initialization, get the columns mapping configuration
+     */
+    public function initializeObject()
+    {
+        parent::initializeObject();
+        $this->tableName = ModelUtility::getModelMapping('SJBR\\StaticInfoTables\\Domain\\Model\\CountryZone', ModelUtility::MAPPING_TABLENAME);
+        $this->columnsMapping = ModelUtility::getModelMapping('SJBR\\StaticInfoTables\\Domain\\Model\\CountryZone', ModelUtility::MAPPING_COLUMNS);
+    }
+
+    /**
+     * Sets the country ISO alpha-2 code.
+     *
+     * @param string $countryIsoCodeA2
+     *
+     * @return void
+     */
+    public function setCountryIsoCodeA2($countryIsoCodeA2)
+    {
+        $this->countryIsoCodeA2 = $countryIsoCodeA2;
+    }
+
+    /**
+     * Gets the country ISO alpha-2 code.
+     *
+     * @return string
+     */
+    public function getCountryIsoCodeA2()
+    {
+        return $this->countryIsoCodeA2;
+    }
+
+    /**
+     * Sets the country ISO alpha-3 code.
+     *
+     * @param string $countryIsoCodeA3
+     *
+     * @return void
+     */
+    public function setCountryIsoCodeA3($countryIsoCodeA3)
+    {
+        $this->countryIsoCodeA3 = $countryIsoCodeA3;
+    }
+
+    /**
+     * Gets the country ISO alpha-3 code.
+     *
+     * @return string
+     */
+    public function getCountryIsoCodeA3()
+    {
+        return $this->countryIsoCodeA3;
+    }
+
+    /**
+     * Sets the country numeric ISO code
+     *
+     * @param int $countryIsoCodeNumber
+     *
+     * @return void
+     */
+    public function setCountryIsoCodeNumber($countryIsoCodeNumber)
+    {
+        $this->countryIsoCodeNumber = $countryIsoCodeNumber;
+    }
+
+    /**
+     * Gets the country numeric ISO code
+     *
+     * @return int
+     */
+    public function getCountryIsoCodeNumber()
+    {
+        return $this->countryIsoCodeNumber;
+    }
+
+    /**
+     * Gets the deletion status of the entity
+     *
+     * @return bool
+     */
+    public function getDeleted()
+    {
+        return $this->deleted;
+    }
+
+    /**
+     * Sets the deletion status of the entity
+     *
+     * @param bool $deleted
+     *
+     * @return void
+     */
+    public function setDeleted($deleted)
+    {
+        return $this->deleted = $deleted;
+    }
+
+    /**
+     * Sets the country zone ISO code.
+     *
+     * @param string $isoCode
+     *
+     * @return void
+     */
+    public function setIsoCode($isoCode)
+    {
+        $this->isoCode = $isoCode;
+    }
+
+    /**
+     * Gets the country zone ISO code.
+     *
+     * @return string
+     */
+    public function getIsoCode()
+    {
+        return $this->isoCode;
+    }
+
+    /**
+     * Sets the local name.
+     *
+     * @param string $localName
+     *
+     * @return void
+     */
+    public function setLocalName($localName)
+    {
+        $this->localName = $localName;
+    }
+
+    /**
+     * Gets the local name.
+     *
+     * @return string
+     */
+    public function getLocalName()
+    {
+        return $this->localName;
+    }
+
+    /**
+     * Sets the English name.
+     *
+     * @param string $nameEn
+     *
+     * @return void
+     */
+    public function setNameEn($nameEn)
+    {
+        $this->nameEn = $nameEn;
+    }
+
+    /**
+     * Returns English name. If empty returns the localName.
+     *
+     * @return string
+     */
+    public function getNameEn()
+    {
+        if ($this->nameEn === '') {
+            return $this->getLocalName();
+        }
+        return $this->nameEn;
+    }
+}
index e85f316..2f1a9af 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 namespace SJBR\StaticInfoTables\Domain\Model;
+
 /***************************************************************
 *  Copyright notice
 *
@@ -30,356 +31,396 @@ namespace SJBR\StaticInfoTables\Domain\Model;
  * @copyright Copyright belongs to the respective authors
  * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 or later
  */
-
 use SJBR\StaticInfoTables\Utility\ModelUtility;
 
-class Currency extends AbstractEntity {
-
-       /**
-        * The number of decimals to be shown when an amount is presented in this currency
-        * @var integer
-        */
-       protected $decimalDigits = 0;
-
-       /**
-        * The character to be shown in front of the decimals when an amount is presented in this currency
-        * @var string
-        */
-       protected $decimalPoint = '';
-
-       /**
-        * Deletion status of the object
-        * @var boolean
-        */
-       protected $deleted = FALSE;
-
-       /**
-        * The divisor used to obtain the subdivision of the currency
-        * @var integer
-        */
-       protected $divisor = 0;
-
-       /**
-        * Currency code as three digit string (i.e. EUR)
-        * ISO 4217 alpha-3 currency code
-        * @var string
-        */
-       protected $isoCodeA3 = '';
-
-       /**
-        * Currency code as number
-        * ISO 4217 numeric currency code
-        * @var integer
-        */
-       protected $isoCodeNumber = 0;
-
-       /**
-        * English name of the currency
-        * @var string
-        */
-       protected $nameEn = '';
-
-       /**
-        * English name of the currency subdivision unit
-        * @var string
-        */
-       protected $subdivisionNameEn = '';
-
-       /**
-        * The symbol to be shown to the left of an amount stated in units of the subdivision of the currency
-        * @var string
-        */
-       protected $subdivisionSymbolLeft = '';
-
-       /**
-        * The symbol to be shown to the right of an amount stated in units of the subdivision of the currency
-        * @var string
-        */
-       protected $subdivisionSymbolRight = '';
-
-       /**
-        * The symbol to be shown to the left of an amount stated in units of the currency
-        * @var string
-        */
-       protected $symbolLeft = '';
-
-       /**
-        * The symbol to be shown to the right of an amount stated in units of the currency
-        * @var string
-        */
-       protected $symbolRight = '';
-
-       /**
-        * Character to be used between every group of thousands of an amount stated in units of this currency
-        * @var string
-        */
-       protected $thousandsPoint = '';
-
-       /**
-        * On initialization, get the columns mapping configuration
-        */
-       public function initializeObject() {
-               parent::initializeObject();
-               $this->tableName = ModelUtility::getModelMapping('SJBR\\StaticInfoTables\\Domain\\Model\\Currency', ModelUtility::MAPPING_TABLENAME);
-               $this->columnsMapping = ModelUtility::getModelMapping('SJBR\\StaticInfoTables\\Domain\\Model\\Currency', ModelUtility::MAPPING_COLUMNS);
-       }
-
-       /**
-        * Sets the number of decimal digits.
-        *
-        * @param integer $decimalDigits
-        *
-        * @return void
-        */
-       public function setDecimalDigits($decimalDigits) {
-               $this->decimalDigits = $decimalDigits;
-       }
-
-       /**
-        * Gets the number of decimal digits.
-        *
-        * @return integer
-        */
-       public function getDecimalDigits() {
-               return $this->decimalDigits;
-       }
-
-       /**
-        * Sets the decimal point character
-        *
-        * @param string $decimalPoint
-        *
-        * @return void
-        */
-       public function setDecimalPoint($decimalPoint) {
-               $this->decimalPoint = $decimalPoint;
-       }
-
-       /**
-        * Gets the decimal point character
-        *
-        * @return string
-        */
-       public function getDecimalPoint() {
-               return $this->decimalPoint;
-       }
-
-       /**
-        * Gets the deletion status of the entity
-        *
-        * @return boolean
-        */
-       public function getDeleted() {
-               return $this->deleted;
-       }
-
-       /**
-        * Sets the deletion status of the entity
-        *
-        * @param boolean $deleted
-        * @return void
-        */
-       public function setDeleted($deleted) {
-               return $this->deleted = $deleted;
-       }
-
-       /**
-        * Sets the divisor.
-        *
-        * @param integer $divisor
-        *
-        * @return void
-        */
-       public function setDivisor($divisor) {
-               $this->divisor = $divisor;
-       }
-
-       /**
-        * Gets the divisor.
-        *
-        * @return integer
-        */
-       public function getDivisor() {
-               return $this->divisor;
-       }
-
-       /**
-        * Sets the ISO alpha-3 code.
-        *
-        * @param string $isoCodeA3
-        *
-        * @return void
-        */
-       public function setIsoCodeA3($isoCodeA3) {
-               $this->isoCodeA3 = $isoCodeA3;
-       }
-
-       /**
-        * Gets the ISO alpha-3 code.
-        *
-        * @return string
-        */
-       public function getIsoCodeA3() {
-               return $this->isoCodeA3;
-       }
-
-       /**
-        * Sets the ISO code number.
-        *
-        * @param integer $isoCodeNumber
-        *
-        * @return void
-        */
-       public function setIsoCodeNumber($isoCodeNumber) {
-               $this->isoCodeNumber = $isoCodeNumber;
-       }
-
-       /**
-        * Gets the ISO code number.
-        *
-        * @return integer
-        */
-       public function getIsoCodeNumber() {
-               return $this->isoCodeNumber;
-       }
-
-       /**
-        * Sets the English name of the currency
-        *
-        * @param string $nameEn
-        *
-        * @return void
-        */
-       public function setNameEn($nameEn) {
-               $this->nameEn = $nameEn;
-       }
-
-       /**
-        * Gets the English name of the currency
-        *
-        * @return string
-        */
-       public function getNameEn() {
-               return $this->nameEn;
-       }
-
-       /**
-        * Sets the English name of the currency subdivision
-        *
-        * @param string $subdivisionNameEn
-        *
-        * @return void
-        */
-       public function setSubdivisionNameEn($subdivisionNameEn) {
-               $this->subdivisionNameEn = $subdivisionNameEn;
-       }
-
-       /**
-        * Gets the English name of the currency subdivision
-        *
-        * @return string
-        */
-       public function getSubdivisionNameEn() {
-               return $this->subdivisionNameEn;
-       }
-
-       /**
-        * Sets the left-hand side symbol for an amount stated in units of the subdivision of the currency
-        *
-        * @param string $subdivisionSymbolLeft
-        *
-        * @return void
-        */
-       public function setSubdivisionSymbolLeft($subdivisionSymbolLeft) {
-               $this->subdivisionSymbolLeft = $subdivisionSymbolLeft;
-       }
-
-       /**
-        * Gets the left-hand side symbol for an amount stated in units of the subdivision of the currency
-        *
-        * @return string
-        */
-       public function getSubdivisionSymbolLeft() {
-               return $this->subdivisionSymbolLeft;
-       }
-
-       /**
-        * Sets the right-hand side symbol for an amount stated in units of the subdivision of the currency
-        *
-        * @param string $subdivisionSymbolRight
-        *
-        * @return void
-        */
-       public function setSubdivisionSymbolRight($subdivisionSymbolRight) {
-               $this->subdivisionSymbolRight = $subdivisionSymbolRight;
-       }
-
-       /**
-        * Gets the right-hand side symbol for an amount stated in units of the subdivision of the currency
-        *
-        * @return string
-        */
-       public function getSubdivisionSymbolRight() {
-               return $this->subdivisionSymbolRight;
-       }
-
-       /**
-        * Sets the symbol to be shown to the left of an amount stated in units of the currency
-        *
-        * @param string $symbolLeft
-        *
-        * @return void
-        */
-       public function setSymbolLeft($symbolLeft) {
-               $this->symbolLeft = $symbolLeft;
-       }
-
-       /**
-        * Gets the symbol to be shown to the left of an amount stated in units of the currency
-        *
-        * @return string
-        */
-       public function getSymbolLeft() {
-               return $this->symbolLeft;
-       }
-
-       /**
-        * Sets the symbol to be shown to the right of an amount stated in units of the currency
-        *
-        * @param string $symbolRight
-        *
-        * @return void
-        */
-       public function setSymbolRight($symbolRight) {
-               $this->symbolRight = $symbolRight;
-       }
-
-       /**
-        * Gets the symbol to be shown to the right of an amount stated in units of the currency
-        *
-        * @return string
-        */
-       public function getSymbolRight() {
-               return $this->symbolRight;
-       }
-
-       /**
-        * Sets the thousands point/separator.
-        *
-        * @param string $thousandsPoint
-        *
-        * @return void
-        */
-       public function setThousandsPoint($thousandsPoint) {
-               $this->thousandsPoint = $thousandsPoint;
-       }
-
-       /**
-        * Gets the thousands point/separator.
-        *
-        * @return string
-        */
-       public function getThousandsPoint() {
-               return $this->thousandsPoint;
-       }
-}
\ No newline at end of file
+class Currency extends AbstractEntity
+{
+    /**
+     * The number of decimals to be shown when an amount is presented in this currency
+     *
+     * @var int
+     */
+    protected $decimalDigits = 0;
+
+    /**
+     * The character to be shown in front of the decimals when an amount is presented in this currency
+     *
+     * @var string
+     */
+    protected $decimalPoint = '';
+
+    /**
+     * Deletion status of the object
+     *
+     * @var bool
+     */
+    protected $deleted = false;
+
+    /**
+     * The divisor used to obtain the subdivision of the currency
+     *
+     * @var int
+     */
+    protected $divisor = 0;
+
+    /**
+     * Currency code as three digit string (i.e. EUR)
+     * ISO 4217 alpha-3 currency code
+     *
+     * @var string
+     */
+    protected $isoCodeA3 = '';
+
+    /**
+     * Currency code as number
+     * ISO 4217 numeric currency code
+     *
+     * @var int
+     */
+    protected $isoCodeNumber = 0;
+
+    /**
+     * English name of the currency
+     *
+     * @var string
+     */
+    protected $nameEn = '';
+
+    /**
+     * English name of the currency subdivision unit
+     *
+     * @var string
+     */
+    protected $subdivisionNameEn = '';
+
+    /**
+     * The symbol to be shown to the left of an amount stated in units of the subdivision of the currency
+     *
+     * @var string
+     */
+    protected $subdivisionSymbolLeft = '';
+
+    /**
+     * The symbol to be shown to the right of an amount stated in units of the subdivision of the currency
+     *
+     * @var string
+     */
+    protected $subdivisionSymbolRight = '';
+
+    /**
+     * The symbol to be shown to the left of an amount stated in units of the currency
+     *
+     * @var string
+     */
+    protected $symbolLeft = '';
+
+    /**
+     * The symbol to be shown to the right of an amount stated in units of the currency
+     *
+     * @var string
+     */
+    protected $symbolRight = '';
+
+    /**
+     * Character to be used between every group of thousands of an amount stated in units of this currency
+     *
+     * @var string
+     */
+    protected $thousandsPoint = '';
+
+    /**
+     * On initialization, get the columns mapping configuration
+     */
+    public function initializeObject()
+    {
+        parent::initializeObject();
+        $this->tableName = ModelUtility::getModelMapping('SJBR\\StaticInfoTables\\Domain\\Model\\Currency', ModelUtility::MAPPING_TABLENAME);
+        $this->columnsMapping = ModelUtility::getModelMapping('SJBR\\StaticInfoTables\\Domain\\Model\\Currency', ModelUtility::MAPPING_COLUMNS);
+    }
+
+    /**
+     * Sets the number of decimal digits.
+     *
+     * @param int $decimalDigits
+     *
+     * @return void
+     */
+    public function setDecimalDigits($decimalDigits)
+    {
+        $this->decimalDigits = $decimalDigits;
+    }
+
+    /**
+     * Gets the number of decimal digits.
+     *
+     * @return int
+     */
+    public function getDecimalDigits()
+    {
+        return $this->decimalDigits;
+    }
+
+    /**
+     * Sets the decimal point character
+     *
+     * @param string $decimalPoint
+     *
+     * @return void
+     */
+    public function setDecimalPoint($decimalPoint)
+    {
+        $this->decimalPoint = $decimalPoint;
+    }
+
+    /**
+     * Gets the decimal point character
+     *
+     * @return string
+     */
+    public function getDecimalPoint()
+    {
+        return $this->decimalPoint;
+    }
+
+    /**
+     * Gets the deletion status of the entity
+     *
+     * @return bool
+     */
+    public function getDeleted()
+    {
+        return $this->deleted;
+    }
+
+    /**
+     * Sets the deletion status of the entity
+     *
+     * @param bool $deleted
+     *
+     * @return void
+     */
+    public function setDeleted($deleted)
+    {
+        return $this->deleted = $deleted;
+    }
+
+    /**
+     * Sets the divisor.
+     *
+     * @param int $divisor
+     *
+     * @return void
+     */
+    public function setDivisor($divisor)
+    {
+        $this->divisor = $divisor;
+    }
+
+    /**
+     * Gets the divisor.
+     *
+     * @return int
+     */
+    public function getDivisor()
+    {
+        return $this->divisor;
+    }
+
+    /**
+     * Sets the ISO alpha-3 code.
+     *
+     * @param string $isoCodeA3
+     *
+     * @return void
+     */
+    public function setIsoCodeA3($isoCodeA3)
+    {
+        $this->isoCodeA3 = $isoCodeA3;
+    }
+
+    /**
+     * Gets the ISO alpha-3 code.
+     *
+     * @return string
+     */
+    public function getIsoCodeA3()
+    {
+        return $this->isoCodeA3;
+    }
+
+    /**
+     * Sets the ISO code number.
+     *
+     * @param int $isoCodeNumber
+     *
+     * @return void
+     */
+    public function setIsoCodeNumber($isoCodeNumber)
+    {
+        $this->isoCodeNumber = $isoCodeNumber;
+    }
+
+    /**
+     * Gets the ISO code number.
+     *
+     * @return int
+     */
+    public function getIsoCodeNumber()
+    {
+        return $this->isoCodeNumber;
+    }
+
+    /**
+     * Sets the English name of the currency
+     *
+     * @param string $nameEn
+     *
+     * @return void
+     */
+    public function setNameEn($nameEn)
+    {
+        $this->nameEn = $nameEn;
+    }
+
+    /**
+     * Gets the English name of the currency
+     *
+     * @return string
+     */
+    public function getNameEn()
+    {
+        return $this->nameEn;
+    }
+
+    /**
+     * Sets the English name of the currency subdivision
+     *
+     * @param string $subdivisionNameEn
+     *
+     * @return void
+     */
+    public function setSubdivisionNameEn($subdivisionNameEn)
+    {
+        $this->subdivisionNameEn = $subdivisionNameEn;
+    }
+
+    /**
+     * Gets the English name of the currency subdivision
+     *
+     * @return string
+     */
+    public function getSubdivisionNameEn()
+    {
+        return $this->subdivisionNameEn;
+    }
+
+    /**
+     * Sets the left-hand side symbol for an amount stated in units of the subdivision of the currency
+     *
+     * @param string $subdivisionSymbolLeft
+     *
+     * @return void
+     */
+    public function setSubdivisionSymbolLeft($subdivisionSymbolLeft)
+    {
+        $this->subdivisionSymbolLeft = $subdivisionSymbolLeft;
+    }
+
+    /**
+     * Gets the left-hand side symbol for an amount stated in units of the subdivision of the currency
+     *
+     * @return string
+     */
+    public function getSubdivisionSymbolLeft()
+    {
+        return $this->subdivisionSymbolLeft;
+    }
+
+    /**
+     * Sets the right-hand side symbol for an amount stated in units of the subdivision of the currency
+     *
+     * @param string $subdivisionSymbolRight
+     *
+     * @return void
+     */
+    public function setSubdivisionSymbolRight($subdivisionSymbolRight)
+    {
+        $this->subdivisionSymbolRight = $subdivisionSymbolRight;
+    }
+
+    /**
+     * Gets the right-hand side symbol for an amount stated in units of the subdivision of the currency
+     *
+     * @return string
+     */
+    public function getSubdivisionSymbolRight()
+    {
+        return $this->subdivisionSymbolRight;
+    }
+
+    /**
+     * Sets the symbol to be shown to the left of an amount stated in units of the currency
+     *
+     * @param string $symbolLeft
+     *
+     * @return void
+     */
+    public function setSymbolLeft($symbolLeft)
+    {
+        $this->symbolLeft = $symbolLeft;
+    }
+
+    /**
+     * Gets the symbol to be shown to the left of an amount stated in units of the currency
+     *
+     * @return string
+     */
+    public function getSymbolLeft()
+    {
+        return $this->symbolLeft;
+    }
+
+    /**
+     * Sets the symbol to be shown to the right of an amount stated in units of the currency
+     *
+     * @param string $symbolRight
+     *
+     * @return void
+     */
+    public function setSymbolRight($symbolRight)
+    {
+        $this->symbolRight = $symbolRight;
+    }
+
+    /**
+     * Gets the symbol to be shown to the right of an amount stated in units of the currency
+     *
+     * @return string
+     */
+    public function getSymbolRight()
+    {
+        return $this->symbolRight;
+    }
+
+    /**
+     * Sets the thousands point/separator.
+     *
+     * @param string $thousandsPoint
+     *
+     * @return void
+     */
+    public function setThousandsPoint($thousandsPoint)
+    {
+        $this->thousandsPoint = $thousandsPoint;
+    }
+
+    /**
+     * Gets the thousands point/separator.
+     *
+     * @return string
+     */
+    public function getThousandsPoint()
+    {
+        return $this->thousandsPoint;
+    }
+}
index b33b01f..8499125 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 namespace SJBR\StaticInfoTables\Domain\Model;
+
 /***************************************************************
 *  Copyright notice
 *
@@ -31,270 +32,297 @@ namespace SJBR\StaticInfoTables\Domain\Model;
  * @copyright Copyright belongs to the respective authors
  * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 or later
  */
-
 use SJBR\StaticInfoTables\Utility\ModelUtility;
 
-class Language extends AbstractEntity {
-       /**
-        * @var string
-        */
-       protected $collatingLocale = '';
-
-       /**
-        * Country code as two digit string (i.e. AT)
-        * Identifies this language as a variant of the language identified by the ISO 639-1 A2 Language code
-        * See also RFC 4646
-        * ISO 3166-1 A2 Country code
-        * @var string
-        */
-       protected $countryIsoCodeA2 = '';
-
-       /**
-        * @var boolean
-        */
-       protected $constructedLanguage = FALSE;
-
-       /**
-        * Deletion status of the object
-        * @var boolean
-        */
-       protected $deleted = FALSE;
-
-       /**
-        * ISO 639-1 A2 Language code
-        * @var string
-        */
-       protected $isoCodeA2 = '';
-
-       /**
-        * Local name: name of language in the language itself
-        * @var string
-        */
-       protected $localName = '';
-
-       /**
-        * English name
-        * @var string
-        */
-       protected $nameEn = '';
-
-       /**
-        * @var boolean
-        */
-       protected $sacredLanguage = FALSE;
-
-       /**
-        * @var string
-        */
-       protected $typo3Code = '';
-
-       /**
-        * On initialization, get the columns mapping configuration
-        */
-       public function initializeObject() {
-               parent::initializeObject();
-               $this->tableName = ModelUtility::getModelMapping('SJBR\\StaticInfoTables\\Domain\\Model\\Language', ModelUtility::MAPPING_TABLENAME);
-               $this->columnsMapping = ModelUtility::getModelMapping('SJBR\\StaticInfoTables\\Domain\\Model\\Language', ModelUtility::MAPPING_COLUMNS);
-       }
-
-       /**
-        * Sets the collating locale.
-        *
-        * @param string $collatingLocale
-        *
-        * @return void
-        */
-       public function setCollatingLocale($collatingLocale) {
-               $this->collatingLocale = $collatingLocale;
-       }
-
-       /**
-        * Gets the collating locale.
-        *
-        * @return string
-        */
-       public function getCollatingLocale() {
-               return $this->collatingLocale;
-       }
-
-       /**
-        * Sets the ISO 3166-1 A2 Country code
-        *
-        * @param string $countryIsoCodeA2
-        *
-        * @return void
-        */
-       public function setCountryIsoCodeA2($countryIsoCodeA2) {
-               $this->countryIsoCodeA2 = $countryIsoCodeA2;
-       }
-
-       /**
-        * Gets the ISO 3166-1 A2 Country code
-        *
-        * @return string
-        */
-       public function getCountryIsoCodeA2() {
-               return $this->countryIsoCodeA2;
-       }
-
-       /**
-        * Sets whether this is a constructed language.
-        *
-        * @param boolean $constructedLanguage
-        *
-        * @return void
-        */
-       public function setConstructedLanguage($constructedLanguage) {
-               $this->constructedLanguage = $constructedLanguage;
-       }
-
-       /**
-        * Gets whether this is a constructed language.
-        *
-        * @return boolean
-        */
-       public function getConstructedLanguage() {
-               return $this->constructedLanguage;
-       }
-
-       /**
-        * Gets whether this is a constructed language.
-        *
-        * This method is a synonym for the getConstructedLanguage method.
-        *
-        * @return boolean
-        */
-       public function isConstructedLanguage() {
-               return $this->getConstructedLanguage();
-       }
-
-       /**
-        * Gets the deletion status of the entity
-        *
-        * @return boolean
-        */
-       public function getDeleted() {
-               return $this->deleted;
-       }
-
-       /**
-        * Sets the deletion status of the entity
-        *
-        * @param boolean $deleted
-        * @return void
-        */
-       public function setDeleted($deleted) {
-               return $this->deleted = $deleted;
-       }
-
-       /**
-        * Sets the ISO 639-1 A2 Language code
-        *
-        * @param string $isoCodeA2
-        *
-        * @return void
-        */
-       public function setIsoCodeA2($isoCodeA2) {
-               $this->isoCodeA2 = $isoCodeA2;
-       }
-
-       /**
-        * Gets the ISO 639-1 A2 Language code
-        *
-        * @return string
-        */
-       public function getIsoCodeA2() {
-               return $this->isoCodeA2;
-       }
-
-       /**
-        * Sets the local name.
-        *
-        * @param string $localName
-        *
-        * @return void
-        */
-       public function setLocalName($localName) {
-               $this->localName = $localName;
-       }
-
-       /**
-        * Gets the local name.
-        *
-        * @return string
-        */
-       public function getLocalName() {
-               return $this->localName;
-       }
-
-       /**
-        * Sets the English name
-        *
-        * @param string $nameEn
-        *
-        * @return void
-        */
-       public function setNameEn($nameEn) {
-               $this->nameEn = $nameEn;
-       }
-
-       /**
-        * Gets the English name
-        *
-        * @return string
-        */
-       public function getNameEn() {
-               return $this->nameEn;
-       }
-
-       /**
-        * Sets whether this is a sacred language.
-        *
-        * @param boolean $sacredLanguage
-        *
-        * @return void
-        */
-       public function setSacredLanguage($sacredLanguage) {
-               $this->sacredLanguage = $sacredLanguage;
-       }
-
-       /**
-        * Gets whether this is a sacred language.
-        *
-        * @return boolean
-        */
-       public function getSacredLanguage() {
-               return $this->sacredLanguage;
-       }
-
-       /**
-        * Sets whether this is a sacred language.
-        *
-        * This method is a synonym for the getSacredLanguage method.
-        *
-        * @return boolean
-        */
-       public function isSacredLanguage() {
-               return $this->getSacredLanguage();
-       }
-
-       /**
-        * Sets the TYPO3 language code.
-        *
-        * @param string $typo3Code
-        *
-        * @return void
-        */
-       public function setTypo3Code($typo3Code) {
-               $this->typo3Code = $typo3Code;
-       }
-
-       /**
-        * Gets the TYPO3 language code.
-        *
-        * @return string
-        */
-       public function getTypo3Code() {
-               return $this->typo3Code;
-       }
-}
\ No newline at end of file
+class Language extends AbstractEntity
+{
+    /**
+     * @var string
+     */
+    protected $collatingLocale = '';
+
+    /**
+     * Country code as two digit string (i.e. AT)
+     * Identifies this language as a variant of the language identified by the ISO 639-1 A2 Language code
+     * See also RFC 4646
+     * ISO 3166-1 A2 Country code
+     *
+     * @var string
+     */
+    protected $countryIsoCodeA2 = '';
+
+    /**
+     * @var bool
+     */
+    protected $constructedLanguage = false;
+
+    /**
+     * Deletion status of the object
+     *
+     * @var bool
+     */
+    protected $deleted = false;
+
+    /**
+     * ISO 639-1 A2 Language code
+     *
+     * @var string
+     */
+    protected $isoCodeA2 = '';
+
+    /**
+     * Local name: name of language in the language itself
+     *
+     * @var string
+     */
+    protected $localName = '';
+
+    /**
+     * English name
+     *
+     * @var string
+     */
+    protected $nameEn = '';
+
+    /**
+     * @var bool
+     */
+    protected $sacredLanguage = false;
+
+    /**
+     * @var string
+     */
+    protected $typo3Code = '';
+
+    /**
+     * On initialization, get the columns mapping configuration
+     */
+    public function initializeObject()
+    {
+        parent::initializeObject();
+        $this->tableName = ModelUtility::getModelMapping('SJBR\\StaticInfoTables\\Domain\\Model\\Language', ModelUtility::MAPPING_TABLENAME);
+        $this->columnsMapping = ModelUtility::getModelMapping('SJBR\\StaticInfoTables\\Domain\\Model\\Language', ModelUtility::MAPPING_COLUMNS);
+    }
+
+    /**
+     * Sets the collating locale.
+     *
+     * @param string $collatingLocale
+     *
+     * @return void
+     */
+    public function setCollatingLocale($collatingLocale)
+    {
+        $this->collatingLocale = $collatingLocale;
+    }
+
+    /**
+     * Gets the collating locale.
+     *
+     * @return string
+     */
+    public function getCollatingLocale()
+    {
+        return $this->collatingLocale;
+    }
+
+    /**
+     * Sets the ISO 3166-1 A2 Country code
+     *
+     * @param string $countryIsoCodeA2
+     *
+     * @return void
+     */
+    public function setCountryIsoCodeA2($countryIsoCodeA2)
+    {
+        $this->countryIsoCodeA2 = $countryIsoCodeA2;
+    }
+
+    /**
+     * Gets the ISO 3166-1 A2 Country code
+     *
+     * @return string
+     */
+    public function getCountryIsoCodeA2()
+    {
+        return $this->countryIsoCodeA2;
+    }
+
+    /**
+     * Sets whether this is a constructed language.
+     *
+     * @param bool $constructedLanguage
+     *
+     * @return void
+     */
+    public function setConstructedLanguage($constructedLanguage)
+    {
+        $this->constructedLanguage = $constructedLanguage;
+    }
+
+    /**
+     * Gets whether this is a constructed language.
+     *
+     * @return bool
+     */
+    public function getConstructedLanguage()
+    {
+        return $this->constructedLanguage;
+    }
+
+    /**
+     * Gets whether this is a constructed language.
+     *
+     * This method is a synonym for the getConstructedLanguage method.
+     *
+     * @return bool
+     */
+    public function isConstructedLanguage()
+    {
+        return $this->getConstructedLanguage();
+    }
+
+    /**
+     * Gets the deletion status of the entity
+     *
+     * @return bool
+     */
+    public function getDeleted()
+    {
+        return $this->deleted;
+    }
+
+    /**
+     * Sets the deletion status of the entity
+     *
+     * @param bool $deleted
+     *
+     * @return void
+     */
+    public function setDeleted($deleted)
+    {
+        return $this->deleted = $deleted;
+    }
+
+    /**
+     * Sets the ISO 639-1 A2 Language code
+     *
+     * @param string $isoCodeA2
+     *
+     * @return void
+     */
+    public function setIsoCodeA2($isoCodeA2)
+    {
+        $this->isoCodeA2 = $isoCodeA2;
+    }
+
+    /**
+     * Gets the ISO 639-1 A2 Language code
+     *
+     * @return string
+     */
+    public function getIsoCodeA2()
+    {
+        return $this->isoCodeA2;
+    }
+
+    /**
+     * Sets the local name.
+     *
+     * @param string $localName
+     *
+     * @return void
+     */
+    public function setLocalName($localName)
+    {
+        $this->localName = $localName;
+    }
+
+    /**
+     * Gets the local name.
+     *
+     * @return string
+     */
+    public function getLocalName()
+    {
+        return $this->localName;
+    }
+
+    /**
+     * Sets the English name
+     *
+     * @param string $nameEn
+     *
+     * @return void
+     */
+    public function setNameEn($nameEn)
+    {
+        $this->nameEn = $nameEn;
+    }
+
+    /**
+     * Gets the English name
+     *
+     * @return string
+     */
+    public function getNameEn()
+    {
+        return $this->nameEn;
+    }
+
+    /**
+     * Sets whether this is a sacred language.
+     *
+     * @param bool $sacredLanguage
+     *
+     * @return void
+     */
+    public function setSacredLanguage($sacredLanguage)
+    {
+        $this->sacredLanguage = $sacredLanguage;
+    }
+
+    /**
+     * Gets whether this is a sacred language.
+     *
+     * @return bool
+     */
+    public function getSacredLanguage()
+    {
+        return $this->sacredLanguage;
+    }
+
+    /**
+     * Sets whether this is a sacred language.
+     *
+     * This method is a synonym for the getSacredLanguage method.
+     *
+     * @return bool
+     */
+    public function isSacredLanguage()
+    {
+        return $this->getSacredLanguage();
+    }
+
+    /**
+     * Sets the TYPO3 language code.
+     *
+     * @param string $typo3Code
+     *
+     * @return void
+     */
+    public function setTypo3Code($typo3Code)
+    {
+        $this->typo3Code = $typo3Code;
+    }
+
+    /**
+     * Gets the TYPO3 language code.
+     *
+     * @return string
+     */
+    public function getTypo3Code()
+    {
+        return $this->typo3Code;
+    }
+}
index 07371dc..432cfb0 100644 (file)
@@ -32,251 +32,280 @@ namespace SJBR\StaticInfoTables\Domain\Model;
  */
 class LanguagePack extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
 {
-       /**
-        * Name of the extension this class belongs to
-        * @var string
-        */
-       protected $extensionName = 'StaticInfoTables';
-
-       /**
-        * @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
-        */
-       protected $objectManager;
-
-       /**
-        * @var string
-        * *@validate StringLength(minimum=1, maximum=255)*
-        */
-       protected $author;
-
-       /**
-        * @var string
-        * *@validate StringLength(minimum=1, maximum=255)*
-        */
-       protected $authorCompany;
-
-       /**
-        * @var string
-        * *@validate EmailAddress*
-        */
-       protected $authorEmail;
-
-       /**
-        * @var string
-        */
-       protected $locale;
-
-       /**
-        * @var string
-        */
-       protected $language;
-
-       /**
-        * @var string
-        */
-       protected $typo3VersionRange;
-
-       /**
-        * @var string
-        */
-       protected $version;
-
-       /**
-        * Injects the object manager
-        *
-        * @param \TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager
-        * @return void
-        */
-       public function injectObjectManager(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager) {
-               $this->objectManager = $objectManager;
-       }
-
-       /**
-        * @var \SJBR\StaticInfoTables\Domain\Repository\CountryRepository
-        */
-       protected $countryRepository;
-
-       /**
-        * Dependency injection of the Country Repository
-        *
-        * @param \SJBR\StaticInfoTables\Domain\Repository\CountryRepository $countryRepository
-        * @return void
-        */
-       public function injectCountryRepository(\SJBR\StaticInfoTables\Domain\Repository\CountryRepository $countryRepository) {
-               $this->countryRepository = $countryRepository;
-       }
-
-       /**
-        * @var \SJBR\StaticInfoTables\Domain\Repository\CountryZoneRepository
-        */
-       protected $countryZoneRepository;
-
-       /**
-        * Dependency injection of the Country Zone Repository
-        *
-        * @param \SJBR\StaticInfoTables\Domain\Repository\CountryZoneRepository $countryZoneRepository
-        * @return void
-        */
-       public function injectCountryZoneRepository(\SJBR\StaticInfoTables\Domain\Repository\CountryZoneRepository $countryZoneRepository) {
-               $this->countryZoneRepository = $countryZoneRepository;
-       }
-
-       /**
-        * @var \SJBR\StaticInfoTables\Domain\Repository\CurrencyRepository
-        */
-       protected $currencyRepository;
-
-       /**
-        * Dependency injection of the Currency Repository
-        *
-        * @param \SJBR\StaticInfoTables\Domain\Repository\CurrencyRepository $currencyRepository
-        * @return void
-        */
-       public function injectCurrencyRepository(\SJBR\StaticInfoTables\Domain\Repository\CurrencyRepository $currencyRepository) {
-               $this->currencyRepository = $currencyRepository;
-       }
-
-       /**
-        * @var \SJBR\StaticInfoTables\Domain\Repository\LanguageRepository
-        */
-       protected $languageRepository;
-
-       /**
-        * Dependency injection of the Language Repository
-        *
-        * @param \SJBR\StaticInfoTables\Domain\Repository\LanguageRepository $languageRepository
-        * @return void
-        */
-       public function injectLanguageRepository(\SJBR\StaticInfoTables\Domain\Repository\LanguageRepository $languageRepository) {
-               $this->languageRepository = $languageRepository;
-       }
-
-       /**
-        * @var \SJBR\StaticInfoTables\Domain\Repository\TerritoryRepository
-        */
-       protected $territoryRepository;
-
-       /**
-        * Dependency injection of the Territory Repository
-        *
-        * @param \SJBR\StaticInfoTables\Domain\Repository\TerritoryRepository $territoryRepository
-        * @return void
-        */
-       public function injectTerritoryRepository(\SJBR\StaticInfoTables\Domain\Repository\TerritoryRepository $territoryRepository) {
-               $this->territoryRepository = $territoryRepository;
-       }
-
-       public function __construct(
-                       $author = '',
-                       $authorCompany = '',
-                       $authorEmail = '',
-                       $locale = '',
-                       $language = ''
-               ) {
-               $this->setAuthor($author);
-               $this->setAuthorCompany($authorCompany);
-               $this->setAuthorEmail($authorEmail);
-               $this->setLocale($locale);
-               $this->setLanguage($language);
-       }
-
-       public function setAuthor($author) {
-               $this->author = $author;
-       }
-
-       public function getAuthor() {
-               return $this->author;
-       }
-
-       public function setAuthorCompany($authorCompany) {
-               $this->authorCompany = $authorCompany;
-       }
-
-       public function getAuthorCompany() {
-               return $this->authorCompany;
-       }
-
-       public function setAuthorEmail($authorEmail) {
-               $this->authorEmail = $authorEmail;
-       }
-
-       public function getAuthorEmail() {
-               return $this->authorEmail;
-       }
-                                                                                                    
-       public function setLocale($locale) {
-               $this->locale = $locale;
-       }
-
-       public function getLocale() {
-               return $this->locale;
-       }
-
-       public function setLanguage($language) {
-               $this->language = $language;
-       }
-
-       public function getLanguage() {
-               return $this->language;
-       }
-
-       public function setTypo3VersionRange($typo3VersionRange) {
-               $this->typo3VersionRange = $typo3VersionRange;
-       }
-
-       public function getTypo3VersionRange() {
-               return $this->typo3VersionRange;
-       }
-
-       public function setVersion($version) {
-               $this->version = $version;
-       }
-
-       public function getVersion() {
-               return $this->version;
-       }
-
-       /**
-        * Gets the localization labels for this language pack
-        *
-        * @return string localization labels in xliff format
-        */
-       public function getLocalizationLabels() {
-               // Build the localization labels of the language pack
-               $XliffParser = $this->objectManager->get('TYPO3\\CMS\\Core\\Localization\\Parser\\XliffParser');
-               $extensionKey = \TYPO3\CMS\Core\Utility\GeneralUtility::camelCaseToLowerCaseUnderscored($this->extensionName);
-               $extensionPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($extensionKey);
-               $sourceXliffFilePath = $extensionPath . 'Resources/Private/Language/locallang_db.xlf';
-               $parsedData = $XliffParser->getParsedData($sourceXliffFilePath, 'default');
-               $localizationLabels = array();
-               $localeLowerCase = strtolower($this->getLocale());
-               $localeUpperCase = strtoupper($this->getLocale());
-               foreach ($parsedData['default'] as $translationElementId => $translationElement) {
-                       if (substr($translationElementId, -3) == '_en') {
-                               $localizationLabels[] = chr(9) . chr(9) . chr(9) . '<trans-unit id="' . substr($translationElementId, 0, -2) . $localeLowerCase . '" xml:space="preserve">';
-                               $localizationLabels[] = chr(9) . chr(9) . chr(9) . chr(9) . '<source>' . str_replace('(EN)', '(' . $localeUpperCase . ')', $translationElement[0]['source']) . '</source>';
-                               if ($translationElement[0]['target']) {
-                                       $localizationLabels[] = chr(9) . chr(9) . chr(9) . chr(9) . '<target>' . str_replace('(EN)', '(' . $localeUpperCase . ')', $translationElement[0]['target']) . '</target>';
-                               }
-                               $localizationLabels[] = chr(9) . chr(9) . chr(9) . '</trans-unit>';
-                       }
-               }
-               return implode(LF, $localizationLabels);
-       }
-
-       /**
-        * 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);
-       }
-}
\ No newline at end of file
+    /**
+     * Name of the extension this class belongs to
+     *
+     * @var string
+     */
+    protected $extensionName = 'StaticInfoTables';
+
+    /**
+     * @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
+     */
+    protected $objectManager;
+
+    /**
+     * @var string
+     * *@validate StringLength(minimum=1, maximum=255)*
+     */
+    protected $author;
+
+    /**
+     * @var string
+     * *@validate StringLength(minimum=1, maximum=255)*
+     */
+    protected $authorCompany;
+
+    /**
+     * @var string
+     * *@validate EmailAddress*
+     */
+    protected $authorEmail;
+
+    /**
+     * @var string
+     */
+    protected $locale;
+
+    /**
+     * @var string
+     */
+    protected $language;
+
+    /**
+     * @var string
+     */
+    protected $typo3VersionRange;
+
+    /**
+     * @var string
+     */
+    protected $version;
+
+    /**
+     * Injects the object manager
+     *
+     * @param \TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager
+     *
+     * @return void
+     */
+    public function injectObjectManager(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager)
+    {
+        $this->objectManager = $objectManager;
+    }
+
+    /**
+     * @var \SJBR\StaticInfoTables\Domain\Repository\CountryRepository
+     */
+    protected $countryRepository;
+
+    /**
+     * Dependency injection of the Country Repository
+     *
+     * @param \SJBR\StaticInfoTables\Domain\Repository\CountryRepository $countryRepository
+     *
+     * @return void
+     */
+    public function injectCountryRepository(\SJBR\StaticInfoTables\Domain\Repository\CountryRepository $countryRepository)
+    {
+        $this->countryRepository = $countryRepository;
+    }
+
+    /**
+     * @var \SJBR\StaticInfoTables\Domain\Repository\CountryZoneRepository
+     */
+    protected $countryZoneRepository;
+
+    /**
+     * Dependency injection of the Country Zone Repository
+     *
+     * @param \SJBR\StaticInfoTables\Domain\Repository\CountryZoneRepository $countryZoneRepository
+     *
+     * @return void
+     */
+    public function injectCountryZoneRepository(\SJBR\StaticInfoTables\Domain\Repository\CountryZoneRepository $countryZoneRepository)
+    {
+        $this->countryZoneRepository = $countryZoneRepository;
+    }
+
+    /**
+     * @var \SJBR\StaticInfoTables\Domain\Repository\CurrencyRepository
+     */
+    protected $currencyRepository;
+
+    /**
+     * Dependency injection of the Currency Repository
+     *
+     * @param \SJBR\StaticInfoTables\Domain\Repository\CurrencyRepository $currencyRepository
+     *
+     * @return void
+     */
+    public function injectCurrencyRepository(\SJBR\StaticInfoTables\Domain\Repository\CurrencyRepository $currencyRepository)
+    {
+        $this->currencyRepository = $currencyRepository;
+    }
+
+    /**
+     * @var \SJBR\StaticInfoTables\Domain\Repository\LanguageRepository
+     */
+    protected $languageRepository;
+
+    /**
+     * Dependency injection of the Language Repository
+     *
+     * @param \SJBR\StaticInfoTables\Domain\Repository\LanguageRepository $languageRepository
+     *
+     * @return void
+     */
+    public function injectLanguageRepository(\SJBR\StaticInfoTables\Domain\Repository\LanguageRepository $languageRepository)
+    {
+        $this->languageRepository = $languageRepository;
+    }
+
+    /**
+     * @var \SJBR\StaticInfoTables\Domain\Repository\TerritoryRepository
+     */
+    protected $territoryRepository;
+
+    /**
+     * Dependency injection of the Territory Repository
+     *
+     * @param \SJBR\StaticInfoTables\Domain\Repository\TerritoryRepository $territoryRepository
+     *
+     * @return void
+     */
+    public function injectTerritoryRepository(\SJBR\StaticInfoTables\Domain\Repository\TerritoryRepository $territoryRepository)
+    {
+        $this->territoryRepository = $territoryRepository;
+    }
+
+    public function __construct(
+            $author = '',
+            $authorCompany = '',
+            $authorEmail = '',
+            $locale = '',
+            $language = ''
+        ) {
+        $this->setAuthor($author);
+        $this->setAuthorCompany($authorCompany);
+        $this->setAuthorEmail($authorEmail);
+        $this->setLocale($locale);
+        $this->setLanguage($language);
+    }
+
+    public function setAuthor($author)
+    {
+        $this->author = $author;
+    }
+
+    public function getAuthor()
+    {
+        return $this->author;
+    }
+
+    public function setAuthorCompany($authorCompany)
+    {
+        $this->authorCompany = $authorCompany;
+    }
+
+    public function getAuthorCompany()
+    {
+        return $this->authorCompany;
+    }
+
+    public function setAuthorEmail($authorEmail)
+    {
+        $this->authorEmail = $authorEmail;
+    }
+
+    public function getAuthorEmail()
+    {
+        return $this->authorEmail;
+    }
+
+    public function setLocale($locale)
+    {
+        $this->locale = $locale;
+    }
+
+    public function getLocale()
+    {
+        return $this->locale;
+    }
+
+    public function setLanguage($language)
+    {
+        $this->language = $language;
+    }
+
+    public function getLanguage()
+    {
+        return $this->language;
+    }
+
+    public function setTypo3VersionRange($typo3VersionRange)
+    {
+        $this->typo3VersionRange = $typo3VersionRange;
+    }
+
+    public function getTypo3VersionRange()
+    {
+        return $this->typo3VersionRange;
+    }
+
+    public function setVersion($version)
+    {
+        $this->version = $version;
+    }
+
+    public function getVersion()
+    {
+        return $this->version;
+    }
+
+    /**
+     * Gets the localization labels for this language pack
+     *
+     * @return string localization labels in xliff format
+     */
+    public function getLocalizationLabels()
+    {
+        // Build the localization labels of the language pack
+        $XliffParser = $this->objectManager->get('TYPO3\\CMS\\Core\\Localization\\Parser\\XliffParser');
+        $extensionKey = \TYPO3\CMS\Core\Utility\GeneralUtility::camelCaseToLowerCaseUnderscored($this->extensionName);
+        $extensionPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($extensionKey);
+        $sourceXliffFilePath = $extensionPath . 'Resources/Private/Language/locallang_db.xlf';
+        $parsedData = $XliffParser->getParsedData($sourceXliffFilePath, 'default');
+        $localizationLabels = [];
+        $localeLowerCase = strtolower($this->getLocale());
+        $localeUpperCase = strtoupper($this->getLocale());
+        foreach ($parsedData['default'] as $translationElementId => $translationElement) {
+            if (substr($translationElementId, -3) == '_en') {
+                $localizationLabels[] = chr(9) . chr(9) . chr(9) . '<trans-unit id="' . substr($translationElementId, 0, -2) . $localeLowerCase . '" xml:space="preserve">';
+                $localizationLabels[] = chr(9) . chr(9) . chr(9) . chr(9) . '<source>' . str_replace('(EN)', '(' . $localeUpperCase . ')', $translationElement[0]['source']) . '</source>';
+                if ($translationElement[0]['target']) {
+                    $localizationLabels[] = chr(9) . chr(9) . chr(9) . chr(9) . '<target>' . str_replace('(EN)', '(' . $localeUpperCase . ')', $translationElement[0]['target']) . '</target>';
+                }
+                $localizationLabels[] = chr(9) . chr(9) . chr(9) . '</trans-unit>';
+            }
+        }
+        return implode(LF, $localizationLabels);
+    }
+
+    /**
+     * Gets the update queries for this language pack
+     *
+     * @return string update queries in sql format
+     */
+    public function getUpdateQueries()
+    {
+        $updateQueries = [];
+        $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);
+    }
+}
index 5a90005..5605563 100644 (file)
@@ -25,7 +25,6 @@ namespace SJBR\StaticInfoTables\Domain\Model;
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
 
-use SJBR\StaticInfoTables\Domain\Model\Language;
 use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
 
 /**
@@ -33,59 +32,60 @@ use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
  */
 class SystemLanguage extends AbstractEntity
 {
-       /**
-        * @var string System language name
-        */
-       protected $title = '';
+    /**
+     * @var string System language name
+     */
+    protected $title = '';
 
-       /**
-        * @var \SJBR\StaticInfoTables\Domain\Model\Language
-        */
-       protected $isoLanguage = null;
+    /**
+     * @var \SJBR\StaticInfoTables\Domain\Model\Language
+     */
+    protected $isoLanguage = null;
 
-       /**
-        * Sets the language name
-        *
-        * @param string $title
-        * @return void
-        */
-       public function setTitle($title)
-       {
-               $this->title = $title;
-       }
+    /**
+     * Sets the language name
+     *
+     * @param string $title
+     *
+     * @return void
+     */
+    public function setTitle($title)
+    {
+        $this->title = $title;
+    }
 
-       /**
-        * Gets the backend language name
-        *
-        * @return string
-        */
-       public function getTitle()
-       {
-               return $this->title;
-       }
+    /**
+     * Gets the backend language name
+     *
+     * @return string
+     */
+    public function getTitle()
+    {
+        return $this->title;
+    }
 
-       /**
-        * Sets the ISO language
-        *
-        * @param Language $isoLanguage
-        * @return void
-        */
-       public function setIsoLanguage(Language $isoLanguage)
-       {
-               $this->isoLanguage = $isoLanguage;
-       }
+    /**
+     * Sets the ISO language
+     *
+     * @param Language $isoLanguage
+     *
+     * @return void
+     */
+    public function setIsoLanguage(Language $isoLanguage)
+    {
+        $this->isoLanguage = $isoLanguage;
+    }
 
-       /**
-        * Gets the ISO language
-        *
-        * @return Language
-        */
-       public function getIsoLanguage()
-       {
-               if ($this->isoLanguage !== null) {
-                       return clone $this->isoLanguage;
-               } else {
-                       return $this->isoLanguage;
-               }
-       }
-}
\ No newline at end of file
+    /**
+     * Gets the ISO language
+     *
+     * @return Language
+     */
+    public function getIsoLanguage()
+    {
+        if ($this->isoLanguage !== null) {
+            return clone $this->isoLanguage;
+        }
+        return $this->isoLanguage;
+    }
+}
index 1c9ce93..9c21c94 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 namespace SJBR\StaticInfoTables\Domain\Model;
+
 /***************************************************************
 *  Copyright notice
 *
@@ -31,120 +32,133 @@ namespace SJBR\StaticInfoTables\Domain\Model;
  * @copyright Copyright belongs to the respective authors
  * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 or later
  */
-
 use SJBR\StaticInfoTables\Utility\ModelUtility;
 
-class Territory extends AbstractEntity {
-
-       /**
-        * Deletion status of the object
-        * @var boolean
-        */
-       protected $deleted = FALSE;
-
-       /**
-        * UN numeric territory code
-        * @var integer
-        */
-       protected $unCodeNumber = 0;
-
-       /**
-        * English name
-        * @var string
-        */
-       protected $nameEn = '';
-
-       /**
-        * UN numeric territory code of parent territory
-        * @var integer
-        */
-       protected $parentTerritoryUnCodeNumber = 0;
-
-       /**
-        * On initialization, get the columns mapping configuration
-        */
-       public function initializeObject() {
-               parent::initializeObject();
-               $this->tableName = ModelUtility::getModelMapping('SJBR\\StaticInfoTables\\Domain\\Model\\Territory', ModelUtility::MAPPING_TABLENAME);
-               $this->columnsMapping = ModelUtility::getModelMapping('SJBR\\StaticInfoTables\\Domain\\Model\\Territory', ModelUtility::MAPPING_COLUMNS);
-       }
-
-       /**
-        * Gets the deletion status of the entity
-        *
-        * @return boolean
-        */
-       public function getDeleted() {
-               return $this->deleted;
-       }
-
-       /**
-        * Sets the deletion status of the entity
-        *
-        * @param boolean $deleted
-        * @return void
-        */
-       public function setDeleted($deleted) {
-               return $this->deleted = $deleted;
-       }
-
-       /**
-        * Sets the English name
-        *
-        * @param string $nameEn
-        *
-        * @return void
-        */
-       public function setNameEn($nameEn) {
-               $this->nameEn = $nameEn;
-       }
-
-       /**
-        * Returns the English name
-        *
-        * @return string
-        */
-       public function getNameEn() {
-               return $this->nameEn;
-       }
-
-       /**
-        * Sets the UN territory numeric code
-        *
-        * @param integer $unCodeNumber
-        *
-        * @return void
-        */
-       public function setUnCodeNumber($unCodeNumber) {
-               $this->unCodeNumber = $unCodeNumber;
-       }
-
-       /**
-        * Returns the UN territory numeric code
-        *
-        * @return integer
-        */
-       public function getUnCodeNumber() {
-               return $this->unCodeNumber;
-       }
-
-       /**
-        * Sets the UN numeric territory code of the parent territory
-        *
-        * @param integer $parentTerritoryUnCodeNumber
-        *
-        * @return void
-        */
-       public function setParentTerritoryUnCodeNumber($parentTerritoryUnCodeNumber) {
-               $this->parentTerritoryUnCodeNumber = $parentTerritoryUnCodeNumber;
-       }
-
-       /**
-        * Returns the UN numeric territory code of the parent territory
-        *
-        * @return integer
-        */
-       public function getParentTerritoryUnCodeNumber() {
-               return $this->parentTerritoryUnCodeNumber;
-       }
-}
\ No newline at end of file
+class Territory extends AbstractEntity
+{
+    /**
+     * Deletion status of the object
+     *
+     * @var bool
+     */
+    protected $deleted = false;
+
+    /**
+     * UN numeric territory code
+     *
+     * @var int
+     */
+    protected $unCodeNumber = 0;
+
+    /**
+     * English name
+     *
+     * @var string
+     */
+    protected $nameEn = '';
+
+    /**
+     * UN numeric territory code of parent territory
+     *
+     * @var int
+     */
+    protected $parentTerritoryUnCodeNumber = 0;
+
+    /**
+     * On initialization, get the columns mapping configuration
+     */
+    public function initializeObject()
+    {
+        parent::initializeObject();
+        $this->tableName = ModelUtility::getModelMapping('SJBR\\StaticInfoTables\\Domain\\Model\\Territory', ModelUtility::MAPPING_TABLENAME);
+        $this->columnsMapping = ModelUtility::getModelMapping('SJBR\\StaticInfoTables\\Domain\\Model\\Territory', ModelUtility::MAPPING_COLUMNS);
+    }
+
+    /**
+     * Gets the deletion status of the entity
+     *
+     * @return bool
+     */
+    public function getDeleted()
+    {
+        return $this->deleted;
+    }
+
+    /**
+     * Sets the deletion status of the entity
+     *
+     * @param bool $deleted
+     *
+     * @return void
+     */
+    public function setDeleted($deleted)
+    {
+        return $this->deleted = $deleted;
+    }
+
+    /**
+     * Sets the English name
+     *
+     * @param string $nameEn
+     *
+     * @return void
+     */
+    public function setNameEn($nameEn)
+    {
+        $this->nameEn = $nameEn;
+    }
+
+    /**
+     * Returns the English name
+     *
+     * @return string
+     */
+    public function getNameEn()
+    {
+        return $this->nameEn;
+    }
+
+    /**
+     * Sets the UN territory numeric code
+     *
+     * @param int $unCodeNumber
+     *
+     * @return void
+     */
+    public function setUnCodeNumber($unCodeNumber)
+    {
+        $this->unCodeNumber = $unCodeNumber;
+    }
+
+    /**
+     * Returns the UN territory numeric code
+     *
+     * @return int
+     */
+    public function getUnCodeNumber()
+    {
+        return $this->unCodeNumber;
+    }
+
+    /**
+     * Sets the UN numeric territory code of the parent territory
+     *
+     * @param int $parentTerritoryUnCodeNumber
+     *
+     * @return void
+     */
+    public function setParentTerritoryUnCodeNumber($parentTerritoryUnCodeNumber)
+    {
+        $this->parentTerritoryUnCodeNumber = $parentTerritoryUnCodeNumber;
+    }
+
+    /**
+     * Returns the UN numeric territory code of the parent territory
+     *
+     * @return int
+     */
+    public function getParentTerritoryUnCodeNumber()
+    {
+        return $this->parentTerritoryUnCodeNumber;
+    }
+}
index f0047ac..50a24a3 100644 (file)
@@ -26,10 +26,9 @@ namespace SJBR\StaticInfoTables\Domain\Repository;
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
 
-use Doctrine\DBAL\Types;
-use Doctrine\DBAL\Types\Type;
 use Doctrine\DBAL\Schema\Column;
 use Doctrine\DBAL\Schema\TableDiff;
+use Doctrine\DBAL\Types\Type;
 use SJBR\StaticInfoTables\Service\SqlSchemaMigrationService;
 use SJBR\StaticInfoTables\Utility\DatabaseUtility;
 use SJBR\StaticInfoTables\Utility\LocalizationUtility;
@@ -52,368 +51,389 @@ use TYPO3\CMS\Extbase\Persistence\Repository;
  */
 abstract class AbstractEntityRepository extends Repository
 {
-       /**
-        * @var string Name of the extension this class belongs to
-        */
-       protected $extensionName = 'StaticInfoTables';
+    /**
+     * @var string Name of the extension this class belongs to
+     */
+    protected $extensionName = 'StaticInfoTables';
 
-       /**
-        * @var \TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper
-        */
-       protected $dataMapper;
+    /**
+     * @var \TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper
+     */
+    protected $dataMapper;
 
-       /**
-        * @var array ISO keys for this static table
-        */
-       protected $isoKeys = array();
+    /**
+     * @var array ISO keys for this static table
+     */
+    protected $isoKeys = [];
 
-       /**
-        * Injects the DataMapper to map nodes to objects
-        *
-        * @param DataMapper $dataMapper
-        * @return void
-        */
-       public function injectDataMapper(DataMapper $dataMapper)
-       {
-               $this->dataMapper = $dataMapper;
-       }
+    /**
+     * Injects the DataMapper to map nodes to objects
+     *
+     * @param DataMapper $dataMapper
+     *
+     * @return void
+     */
+    public function injectDataMapper(DataMapper $dataMapper)
+    {
+        $this->dataMapper = $dataMapper;
+    }
 
-       /**
-        * Initializes the repository.
-        *
-        * @return void
-        */
-       public function initializeObject()
-       {
-               $querySettings = $this->objectManager->get(Typo3QuerySettings::class);
-               $querySettings->setRespectStoragePage(false);
-               $this->setDefaultQuerySettings($querySettings);
-       }
+    /**
+     * Initializes the repository.
+     *
+     * @return void
+     */
+    public function initializeObject()
+    {
+        $querySettings = $this->objectManager->get(Typo3QuerySettings::class);
+        $querySettings->setRespectStoragePage(false);
+        $this->setDefaultQuerySettings($querySettings);
+    }
 
-       /**
-        * Find all with deleted included
-        *
-        * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface|array all entries
-        */
-       public function findAllDeletedIncluded()
-       {
-               $querySettings = $this->objectManager->get(QuerySettingsInterface::class);
-               $querySettings->setStoragePageIds(array(0));
-               $querySettings->setIncludeDeleted(true);
-               $this->setDefaultQuerySettings($querySettings);
-               return parent::findAll();
-       }
+    /**
+     * Find all with deleted included
+     *
+     * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface|array all entries
+     */
+    public function findAllDeletedIncluded()
+    {
+        $querySettings = $this->objectManager->get(QuerySettingsInterface::class);
+        $querySettings->setStoragePageIds([0]);
+        $querySettings->setIncludeDeleted(true);
+        $this->setDefaultQuerySettings($querySettings);
+        return parent::findAll();
+    }
 
-       /**
-        * Find all objects with uid in list
-        *
-        * @param string $list: list of uid's
-        * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface|array all entries
-        */
-       public function findAllByUidInList($list = '')
-       {
-               if (empty($list)) {
-                       return array();
-               } else {
-                       $query = $this->createQuery();
-                       $list = GeneralUtility::trimExplode(',', $list, true);
-                       $query->matching($query->in('uid', $list));
-                       return $query->execute();
-               }
-       }
+    /**
+     * Find all objects with uid in list
+     *
+     * @param string $list: list of uid's
+     *
+     * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface|array all entries
+     */
+    public function findAllByUidInList($list = '')
+    {
+        if (empty($list)) {
+            return [];
+        }
+        $query = $this->createQuery();
+        $list = GeneralUtility::trimExplode(',', $list, true);
+        $query->matching($query->in('uid', $list));
+        return $query->execute();
+    }
 
-       /**
-        * Find all ordered by the localized name
-        *
-        * @param string $orderDirection may be "asc" or "desc". Default is "asc".
-        * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface|array all entries ordered by localized name
-        */
-       protected function findAllOrderedByLocalizedName($orderDirection = 'asc')
-       {
-               $entities = parent::findAll();
-               return $this->localizedSort($entities, $orderDirection);
-       }
+    /**
+     * Find all ordered by the localized name
+     *
+     * @param string $orderDirection may be "asc" or "desc". Default is "asc".
+     *
+     * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface|array all entries ordered by localized name
+     */
+    protected function findAllOrderedByLocalizedName($orderDirection = 'asc')
+    {
+        $entities = parent::findAll();
+        return $this->localizedSort($entities, $orderDirection);
+    }
 
-       /**
-        * Sort entities by the localized name
-        *
-        * @param QueryResultInterface $entities to be sorted
-        * @param string $orderDirection may be "asc" or "desc". Default is "asc".
-        * @return array entities ordered by localized name
-        */
-       public function localizedSort(QueryResultInterface $entities, $orderDirection = 'asc')
-       {
-               $result = $entities->toArray();
-               $locale = LocalizationUtility::setCollatingLocale();
-               if ($locale !== FALSE) {
-                       if ($orderDirection === 'asc') {
-                               uasort($result, array($this, 'strcollOnLocalizedName'));
-                       } else {
-                               uasort($result, array($this, 'strcollOnLocalizedNameDesc'));
-                       }
-               }
-               return $result;
-       }
+    /**
+     * Sort entities by the localized name
+     *
+     * @param QueryResultInterface $entities to be sorted
+     * @param string $orderDirection may be "asc" or "desc". Default is "asc".
+     *
+     * @return array entities ordered by localized name
+     */
+    public function localizedSort(QueryResultInterface $entities, $orderDirection = 'asc')
+    {
+        $result = $entities->toArray();
+        $locale = LocalizationUtility::setCollatingLocale();
+        if ($locale !== false) {
+            if ($orderDirection === 'asc') {
+                uasort($result, [$this, 'strcollOnLocalizedName']);
+            } else {
+                uasort($result, [$this, 'strcollOnLocalizedNameDesc']);
+            }
+        }
+        return $result;
+    }
 
-       /**
-        * Using strcoll comparison on localized names
-        *
-        * @return integer see strcoll
-        */
-       protected function strcollOnLocalizedName($entityA, $entityB)
-       {
-               return strcoll($entityA->getNameLocalized(), $entityB->getNameLocalized());
-       }
+    /**
+     * Using strcoll comparison on localized names
+     *
+     * @return int see strcoll
+     *
+     * @param mixed $entityA
+     * @param mixed $entityB
+     */
+    protected function strcollOnLocalizedName($entityA, $entityB)
+    {
+        return strcoll($entityA->getNameLocalized(), $entityB->getNameLocalized());
+    }
 
-       /**
-        * Using strcoll comparison on localized names - descending order
-        *
-        * @return integer see strcoll
-        */
-       protected function strcollOnLocalizedNameDesc($entityA, $entityB)
-       {
-               return strcoll($entityB->getNameLocalized(), $entityA->getNameLocalized());
-       }
+    /**
+     * Using strcoll comparison on localized names - descending order
+     *
+     * @return int see strcoll
+     *
+     * @param mixed $entityA
+     * @param mixed $entityB
+     */
+    protected function strcollOnLocalizedNameDesc($entityA, $entityB)
+    {
+        return strcoll($entityB->getNameLocalized(), $entityA->getNameLocalized());
+    }
 
-       /**
-        * Find all ordered by given property name
-        *
-        * @param string $propertyName property name to order by
-        * @param string $orderDirection may be "asc" or "desc". Default is "asc".
-        *
-        * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface|array all entries ordered by $propertyName
-        */
-       public function findAllOrderedBy($propertyName, $orderDirection = 'asc')
-       {
-               $queryResult = array();
+    /**
+     * Find all ordered by given property name
+     *
+     * @param string $propertyName property name to order by
+     * @param string $orderDirection may be "asc" or "desc". Default is "asc".
+     *
+     * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface|array all entries ordered by $propertyName
+     */
+    public function findAllOrderedBy($propertyName, $orderDirection = 'asc')
+    {
+        $queryResult = [];
 
-               if ($orderDirection !== 'asc' && $orderDirection !== 'desc') {
-                       throw new \InvalidArgumentException('Order direction must be "asc" or "desc".', 1316607580);
-               }
+        if ($orderDirection !== 'asc' && $orderDirection !== 'desc') {
+            throw new \InvalidArgumentException('Order direction must be "asc" or "desc".', 1316607580);
+        }
 
-               if ($propertyName == 'nameLocalized') {
-                       $queryResult = $this->findAllOrderedByLocalizedName($orderDirection);
-               } else {
-                       $query = $this->createQuery();
+        if ($propertyName == 'nameLocalized') {
+            $queryResult = $this->findAllOrderedByLocalizedName($orderDirection);
+        } else {
+            $query = $this->createQuery();
 
-                       $object = $this->objectManager->get($this->objectType);
-                       if (!array_key_exists($propertyName, $object->_getProperties())) {
-                               throw new \InvalidArgumentException('The model "' . $this->objectType . '" has no property "' . $propertyName . '" to order by.', 1316607579);
-                       }
+            $object = $this->objectManager->get($this->objectType);
+            if (!array_key_exists($propertyName, $object->_getProperties())) {
+                throw new \InvalidArgumentException('The model "' . $this->objectType . '" has no property "' . $propertyName . '" to order by.', 1316607579);
+            }
 
-                       if ($orderDirection === 'asc') {
-                               $orderDirection = QueryInterface::ORDER_ASCENDING;
-                       } else {
-                               $orderDirection = QueryInterface::ORDER_DESCENDING;
-                       }
-                       $query->setOrderings(array($propertyName => $orderDirection));
+            if ($orderDirection === 'asc') {
+                $orderDirection = QueryInterface::ORDER_ASCENDING;
+            } else {
+                $orderDirection = QueryInterface::ORDER_DESCENDING;
+            }
+            $query->setOrderings([$propertyName => $orderDirection]);
 
-                       return $query->execute();
-               }
-               return $queryResult;
-       }
+            return $query->execute();
+        }
+        return $queryResult;
+    }
 
-       /**
-        * Adds localization columns, if needed
-        *
-        * @param string $locale: the locale for which localization columns should be added
-        * @return AbstractEntityRepository $this
-        */
-       public function addLocalizationColumns($locale) {
-               $dataMap = $this->dataMapper->getDataMap($this->objectType);
-               $tableName = $dataMap->getTableName();
-               $fieldsInfo = $this->getFieldsInfo();
-               $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
-               foreach ($fieldsInfo as $field => $fieldInfo) {
-                       if ($field != 'cn_official_name_en') {
-                               $matches = array();
-                               if (preg_match('#_en$#', $field, $matches)) {
-                                       // Make localization field name
-                                       $localizationField = preg_replace('#_en$#', '_' . $locale, $field);
-                                       // Add the field if it does not yet exist
-                                       if (!$fieldsInfo[$localizationField]) {
-                                               // Get field length
-                                               $matches = array();
-                                               if (preg_match('#\(([0-9]+)\)#', $fieldInfo['Type'], $matches)) {
-                                                       $localizationFieldLength = intval($matches[1]);
-                                                       // Add the localization field
-                                                       $connection = $connectionPool->getConnectionForTable($tableName);
-                                                       $column = new Column($localizationField, Type::getType(Type::STRING));
-                                                       $column->setLength($localizationFieldLength)
-                                                               ->setNotnull(true)
-                                                               ->setDefault('');
-                                                       $tableDiff = new TableDiff($tableName, [$column]);
-                                                       $query = $connection->getDatabasePlatform()->getAlterTableSQL($tableDiff);
-                                                       $connection->executeUpdate($query[0]);
-                                               }
-                                       }
-                               }
-                       }
-               }
-               return $this;
-       }
+    /**
+     * Adds localization columns, if needed
+     *
+     * @param string $locale: the locale for which localization columns should be added
+     *
+     * @return AbstractEntityRepository $this
+     */
+    public function addLocalizationColumns($locale)
+    {
+        $dataMap = $this->dataMapper->getDataMap($this->objectType);
+        $tableName = $dataMap->getTableName();
+        $fieldsInfo = $this->getFieldsInfo();
+        $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
+        foreach ($fieldsInfo as $field => $fieldInfo) {
+            if ($field != 'cn_official_name_en') {
+                $matches = [];
+                if (preg_match('#_en$#', $field, $matches)) {
+                    // Make localization field name
+                    $localizationField = preg_replace('#_en$#', '_' . $locale, $field);
+                    // Add the field if it does not yet exist
+                    if (!$fieldsInfo[$localizationField]) {
+                        // Get field length
+                        $matches = [];
+                        if (preg_match('#\\(([0-9]+)\\)#', $fieldInfo['Type'], $matches)) {
+                            $localizationFieldLength = (int)($matches[1]);
+                            // Add the localization field
+                            $connection = $connectionPool->getConnectionForTable($tableName);
+                            $column = new Column($localizationField, Type::getType(Type::STRING));
+                            $column->setLength($localizationFieldLength)
+                                ->setNotnull(true)
+                                ->setDefault('');
+                            $tableDiff = new TableDiff($tableName, [$column]);
+                            $query = $connection->getDatabasePlatform()->getAlterTableSQL($tableDiff);
+                            $connection->executeUpdate($query[0]);
+                        }
+                    }
+                }
+            }
+        }
+        return $this;
+    }
 
-       /**
-        * Get the information on the table fields
-        *
-        * @return array table fields information array
-        */
-       protected function getFieldsInfo()
-       {
-               $fieldsInfo = array();
-               $dataMap = $this->dataMapper->getDataMap($this->objectType);
-               $tableName = $dataMap->getTableName();
-               $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
-               $connection = $connectionPool->getConnectionForTable($tableName);
-               $query = $connection->getDatabasePlatform()->getListTableColumnsSQL($tableName, $connection->getDatabase());
-               $columnsInfo = $connection->executeQuery($query);
-               foreach ($columnsInfo as $fieldRow) {
-                       $fieldsInfo[$fieldRow['Field']] = $fieldRow;
-               }
-               return $fieldsInfo;
-       }
+    /**
+     * Get the information on the table fields
+     *
+     * @return array table fields information array
+     */
+    protected function getFieldsInfo()
+    {
+        $fieldsInfo = [];
+        $dataMap = $this->dataMapper->getDataMap($this->objectType);
+        $tableName = $dataMap->getTableName();
+        $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
+        $connection = $connectionPool->getConnectionForTable($tableName);
+        $query = $connection->getDatabasePlatform()->getListTableColumnsSQL($tableName, $connection->getDatabase());
+        $columnsInfo = $connection->executeQuery($query);
+        foreach ($columnsInfo as $fieldRow) {
+            $fieldsInfo[$fieldRow['Field']] = $fieldRow;
+        }
+        return $fieldsInfo;
+    }
 
-       /**
-        * Get update queries for the localization columns for a given locale
-        *
-        * @return array Update queries
-        */
-       public function getUpdateQueries($locale)
-       {
-               // Get the information of the table and its fields
-               $dataMap = $this->dataMapper->getDataMap($this->objectType);
-               $tableName = $dataMap->getTableName();
-               $tableFields = array_keys($this->getFieldsInfo());
-               $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
-               $connection = $connectionPool->getConnectionForTable($tableName);
-               $updateQueries = array();
-               // If the language pack is not yet created or not yet installed, the localization columns are not yet part of the domain model
-               $exportFields = array();
-               foreach ($tableFields as $field) {
-                       $matches = array();
-                       if (preg_match('#_' . strtolower($locale) . '$#', $field, $matches)) {
-                               $exportFields[] = $field;
-                       }
-               }
-               if (count($exportFields)) {
-                       $updateQueries[] = '## ' . $tableName;
-                       $exportFields = array_merge($exportFields, $this->isoKeys);
-                       $queryBuilder = $connectionPool->getQueryBuilderForTable($tableName);
-                       $queryBuilder->getRestrictions()->removeAll();
-                       $queryBuilder->select($exportFields[0]);
-                       array_shift($exportFields);
-                       foreach ($exportFields as $exportField) {
-                               $queryBuilder->addSelect($exportField);
-                       }
-                       $rows = $queryBuilder
-                               ->from($tableName)
-                               ->execute()
-                               ->fetchAll();
-                       foreach ($rows as $row) {
-                               $set = array();
-                               foreach ($row as $field => $value) {
-                                       if (!in_array($field, $this->isoKeys)) {
-                                               $set[] = $field . '=' . $connection->quote($value);
-                                       }
-                               }
-                               $whereClause = '';
-                               foreach ($this->isoKeys as $field) {
-                                       $whereClause .= ($whereClause ? ' AND ' : ' WHERE ') . $field . '=' . $connection->quote($row[$field]);
-                               }
-                               $updateQueries[] = 'UPDATE ' . $tableName . ' SET ' . implode(',', $set) . $whereClause . ';';
-                       }
-               }
-               return $updateQueries;
-       }
+    /**
+     * Get update queries for the localization columns for a given locale
+     *
+     * @return array Update queries
+     *
+     * @param mixed $locale
+     */
+    public function getUpdateQueries($locale)
+    {
+        // Get the information of the table and its fields
+        $dataMap = $this->dataMapper->getDataMap($this->objectType);
+        $tableName = $dataMap->getTableName();
+        $tableFields = array_keys($this->getFieldsInfo());
+        $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
+        $connection = $connectionPool->getConnectionForTable($tableName);
+        $updateQueries = [];
+        // If the language pack is not yet created or not yet installed, the localization columns are not yet part of the domain model
+        $exportFields = [];
+        foreach ($tableFields as $field) {
+            $matches = [];
+            if (preg_match('#_' . strtolower($locale) . '$#', $field, $matches)) {
+                $exportFields[] = $field;
+            }
+        }
+        if (count($exportFields)) {
+            $updateQueries[] = '## ' . $tableName;
+            $exportFields = array_merge($exportFields, $this->isoKeys);
+            $queryBuilder = $connectionPool->getQueryBuilderForTable($tableName);
+            $queryBuilder->getRestrictions()->removeAll();
+            $queryBuilder->select($exportFields[0]);
+            array_shift($exportFields);
+            foreach ($exportFields as $exportField) {
+                $queryBuilder->addSelect($exportField);
+            }
+            $rows = $queryBuilder
+                ->from($tableName)
+                ->execute()
+                ->fetchAll();
+            foreach ($rows as $row) {
+                $set = [];
+                foreach ($row as $field => $value) {
+                    if (!in_array($field, $this->isoKeys)) {
+                        $set[] = $field . '=' . $connection->quote($value);
+                    }
+                }
+                $whereClause = '';
+                foreach ($this->isoKeys as $field) {
+                    $whereClause .= ($whereClause ? ' AND ' : ' WHERE ') . $field . '=' . $connection->quote($row[$field]);
+                }
+                $updateQueries[] = 'UPDATE ' . $tableName . ' SET ' . implode(',', $set) . $whereClause . ';';
+            }
+        }
+        return $updateQueries;
+    }
 
-       /**
-        * Dump non-localized contents of the repository
-        *
-        * @return      void
-        */
-       public function sqlDumpNonLocalizedData()
-       {
-               // Get the information of the table and its fields
-               $dataMap = $this->dataMapper->getDataMap($this->objectType);
-               $tableName = $dataMap->getTableName();
+    /**
+     * Dump non-localized contents of the repository
+     *
+     * @return void
+     */
+    public function sqlDumpNonLocalizedData()
+    {
+        // Get the information of the table and its fields
+        $dataMap = $this->dataMapper->getDataMap($this->objectType);
+        $tableName = $dataMap->getTableName();
 
-               $sqlSchemaMigrationService = $this->objectManager->get(SqlSchemaMigrationService::class);
-               $dbFieldDefinitions = $sqlSchemaMigrationService->getFieldDefinitions_database();
-               $dbFields = array();
-               $dbFields[$tableName] = $dbFieldDefinitions[$tableName];
+        $sqlSchemaMigrationService = $this->objectManager->get(SqlSchemaMigrationService::class);
+        $dbFieldDefinitions = $sqlSchemaMigrationService->getFieldDefinitions_database();
+        $dbFields = [];
+        $dbFields[$tableName] = $dbFieldDefinitions[$tableName];
 
-               $extensionKey = GeneralUtility::camelCaseToLowerCaseUnderscored($this->extensionName);
-               $extensionPath = ExtensionManagementUtility::extPath($extensionKey);
-               $ext_tables = GeneralUtility::getUrl($extensionPath . 'ext_tables.sql');
+        $extensionKey = GeneralUtility::camelCaseToLowerCaseUnderscored($this->extensionName);
+        $extensionPath = ExtensionManagementUtility::extPath($extensionKey);
+        $ext_tables = GeneralUtility::getUrl($extensionPath . 'ext_tables.sql');
 
-               $tableFields = array_keys($dbFields[$tableName]['fields']);
-               foreach ($tableFields as $field) {
-                       // This is a very simple check if the field is from static_info_tables and not from a language pack
-                       $match = array();
-                       if (!preg_match('#' . preg_quote($field) . '#m', $ext_tables, $match)) {
-                               unset($dbFields[$tableName]['fields'][$field]);
-                       }
-               }
+        $tableFields = array_keys($dbFields[$tableName]['fields']);
+        foreach ($tableFields as $field) {
+            // This is a very simple check if the field is from static_info_tables and not from a language pack
+            $match = [];
+            if (!preg_match('#' . preg_quote($field) . '#m', $ext_tables, $match)) {
+                unset($dbFields[$tableName]['fields'][$field]);
+            }
+        }
 
-               $databaseUtility = GeneralUtility::makeInstance(DatabaseUtility::class);
-               return $databaseUtility->dumpStaticTables($dbFields);
-       }
+        $databaseUtility = GeneralUtility::makeInstance(DatabaseUtility::class);
+        return $databaseUtility->dumpStaticTables($dbFields);
+    }
 
-       /**
-        * Adds an object to this repository.
-        *
-        * @param object $object The object to add
-        *
-        * @return void
-        *
-        * @throws \BadMethodCallException(
-        */
-       public function add($object) {
-               throw new \BadMethodCallException(
-                       'This is a read-only repository in which the add method must not be called.', 1420485488
-               );
-       }
+    /**
+     * Adds an object to this repository.
+     *
+     * @param object $object The object to add
+     *
+     * @return void
+     *
+     * @throws \BadMethodCallException(
+     */
+    public function add($object)
+    {
+        throw new \BadMethodCallException(
+            'This is a read-only repository in which the add method must not be called.',
+            1420485488
+        );
+    }
 
-       /**
-        * Removes an object from this repository.
-        *
-        * @param object $object The object to remove
-        *
-        * @return void
-        *
-        * @throws \BadMethodCallException(
-        */
-       public function remove($object) {
-               throw new \BadMethodCallException(
-                       'This is a read-only repository in which the remove method must not be called.', 1420485646
-               );
-       }
+    /**
+     * Removes an object from this repository.
+     *
+     * @param object $object The object to remove
+     *
+     * @return void
+     *
+     * @throws \BadMethodCallException(
+     */
+    public function remove($object)
+    {
+        throw new \BadMethodCallException(
+            'This is a read-only repository in which the remove method must not be called.',
+            1420485646
+        );
+    }
 
-       /**
-        * Replaces an existing object with the same identifier by the given object.
-        *
-        * @param object $modifiedObject The modified object
-        *
-        * @return void
-        *
-        * @throws \BadMethodCallException(
-        */
-       public function update($modifiedObject) {
-               throw new \BadMethodCallException(
-                       'This is a read-only repository in which the update method must not be called.', 1420485660
-               );
-       }
+    /**
+     * Replaces an existing object with the same identifier by the given object.
+     *
+     * @param object $modifiedObject The modified object
+     *
+     * @return void
+     *
+     * @throws \BadMethodCallException(
+     */
+    public function update($modifiedObject)
+    {
+        throw new \BadMethodCallException(
+            'This is a read-only repository in which the update method must not be called.',
+            1420485660
+        );
+    }
 
-       /**
-        * Removes all objects of this repository as if remove() was called for all of them.
-        *
-        * @return void
-        *
-        * @throws \BadMethodCallException(
-        */
-       public function removeAll() {
-               throw new \BadMethodCallException(
-                       'This is a read-only repository in which the removeAll method must not be called.', 1420485668
-               );
-       }
-}
\ No newline at end of file
+    /**
+     * Removes all objects of this repository as if remove() was called for all of them.
+     *
+     * @return void
+     *
+     * @throws \BadMethodCallException(
+     */
+    public function removeAll()
+    {
+        throw new \BadMethodCallException(
+            'This is a read-only repository in which the removeAll method must not be called.',
+            1420485668
+        );
+    }
+}
index 0df6b5b..fbcb8dd 100644 (file)
@@ -33,84 +33,89 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
  */
 class CountryRepository extends AbstractEntityRepository
 {
+    /**
+     * ISO keys for this static table
+     *
+     * @var array
+     */
+    protected $isoKeys = ['cn_iso_2'];
 
-       /**
-        * ISO keys for this static table
-        * @var array
-        */
-       protected $isoKeys = array('cn_iso_2');
+    /**
+     * @var \SJBR\StaticInfoTables\Domain\Repository\TerritoryRepository
+     */
+    protected $territoryRepository;
 
-       /**
-        * @var \SJBR\StaticInfoTables\Domain\Repository\TerritoryRepository
-        */
-       protected $territoryRepository;
+    /**
+     * Dependency injection of the Territory Repository
+     *
+     * @param \SJBR\StaticInfoTables\Domain\Repository\TerritoryRepository $territoryRepository
+     *
+     * @return void
+     */
+    public function injectTerritoryRepository(\SJBR\StaticInfoTables\Domain\Repository\TerritoryRepository $territoryRepository)
+    {
+        $this->territoryRepository = $territoryRepository;
+    }
 
-       /**
-        * Dependency injection of the Territory Repository
-        *
-        * @param \SJBR\StaticInfoTables\Domain\Repository\TerritoryRepository $territoryRepository
-        * @return void
-        */
-       public function injectTerritoryRepository(\SJBR\StaticInfoTables\Domain\Repository\TerritoryRepository $territoryRepository) {
-               $this->territoryRepository = $territoryRepository;
-       }
+    /**
+     * 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 = [$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();
+    }
 
-       /**
-        * 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();
-       }
+    /**
+     * Finds countries by territory ordered by localized name
+     *
+     * @param \SJBR\StaticInfoTables\Domain\Model\Territory $territory
+     *
+     * @return array Countries of the territory sorted by localized name
+     */
+    public function findByTerritoryOrderedByLocalizedName(\SJBR\StaticInfoTables\Domain\Model\Territory $territory)
+    {
+        $entities = $this->findByTerritory($territory);
+        return $this->localizedSort($entities);
+    }
 
-       /**
-        * Finds countries by territory ordered by localized name
-        *
-        * @param \SJBR\StaticInfoTables\Domain\Model\Territory $territory
-        *
-        * @return array Countries of the territory sorted by localized name
-        */
-       public function findByTerritoryOrderedByLocalizedName(\SJBR\StaticInfoTables\Domain\Model\Territory $territory) {
-               $entities = $this->findByTerritory($territory);
-               return $this->localizedSort($entities);
-       }
-
-       /**
-        * Finds a set of allowed countries
-        *
-        * @param string $allowedCountries: list of alpha-3 country codes
-        * @return array the selected countries
-        */
-       public function findAllowedByIsoCodeA3($allowedCountries = '')
-       {
-               $query = $this->createQuery();
-               $countries = GeneralUtility::trimExplode(',', $allowedCountries, true);
-               $query->matching(
-                       $query->in('isoCodeA3', $countries)
-               );
-               $entities = $query->execute();
-               $orderedCountries = array();
-               foreach ($countries as $isoCodeA3) {
-                       foreach ($entities as $entity) {
-                               if ($entity->getIsoCodeA3() === $isoCodeA3) {
-                                       $orderedCountries[] = $entity;
-                                       break;
-                               }
-                       }
-               }
-               return $orderedCountries;
-       }
-}
\ No newline at end of file
+    /**
+     * Finds a set of allowed countries
+     *
+     * @param string $allowedCountries: list of alpha-3 country codes
+     *
+     * @return array the selected countries
+     */
+    public function findAllowedByIsoCodeA3($allowedCountries = '')
+    {
+        $query = $this->createQuery();
+        $countries = GeneralUtility::trimExplode(',', $allowedCountries, true);
+        $query->matching(
+            $query->in('isoCodeA3', $countries)
+        );
+        $entities = $query->execute();
+        $orderedCountries = [];
+        foreach ($countries as $isoCodeA3) {
+            foreach ($entities as $entity) {
+                if ($entity->getIsoCodeA3() === $isoCodeA3) {
+                    $orderedCountries[] = $entity;
+                    break;
+                }
+            }
+        }
+        return $orderedCountries;
+    }
+}
index c40dab6..8718e22 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 namespace SJBR\StaticInfoTables\Domain\Repository;
+
 /***************************************************************
 *  Copyright notice
 *
@@ -28,38 +29,39 @@ namespace SJBR\StaticInfoTables\Domain\Repository;
 /**
  * Repository for \SJBR\StaticInfoTables\Domain\Model\CountryZone
  */
-class CountryZoneRepository extends AbstractEntityRepository {
-
-       /**
-        * @var array ISO keys for this static table
-        */
-       protected $isoKeys = array('zn_country_iso_2', 'zn_code');
+class CountryZoneRepository extends AbstractEntityRepository
+{
+    /**
+     * @var array ISO keys for this static table
+     */
+    protected $isoKeys = ['zn_country_iso_2', 'zn_code'];
 
-       /**
-        * Finds country zones by country
-        *
-        * @param \SJBR\StaticInfoTables\Domain\Model\Country $country
-        *
-        * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface|array
-        */
-       public function findByCountry(\SJBR\StaticInfoTables\Domain\Model\Country $country) {
-               $query = $this->createQuery();
-               $query->matching(
-                       $query->equals('countryIsoCodeNumber', $country->getIsoCodeNumber())
-               );
-               return $query->execute();
-       }
+    /**
+     * Finds country zones by country
+     *
+     * @param \SJBR\StaticInfoTables\Domain\Model\Country $country
+     *
+     * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface|array
+     */
+    public function findByCountry(\SJBR\StaticInfoTables\Domain\Model\Country $country)
+    {
+        $query = $this->createQuery();
+        $query->matching(
+            $query->equals('countryIsoCodeNumber', $country->getIsoCodeNumber())
+        );
+        return $query->execute();
+    }
 
-       /**
-        * Finds country zones by country ordered by localized name
-        *
-        * @param \SJBR\StaticInfoTables\Domain\Model\Country $country
-        *
-        * @return array Country zones of the country sorted by localized name
-        */
-       public function findByCountryOrderedByLocalizedName(\SJBR\StaticInfoTables\Domain\Model\Country $country) {
-               $entities = $this->findByCountry($country);
-               return $this->localizedSort($entities);
-       }
+    /**
+     * Finds country zones by country ordered by localized name
+     *
+     * @param \SJBR\StaticInfoTables\Domain\Model\Country $country
+     *
+     * @return array Country zones of the country sorted by localized name
+     */
+    public function findByCountryOrderedByLocalizedName(\SJBR\StaticInfoTables\Domain\Model\Country $country)
+    {
+        $entities = $this->findByCountry($country);
+        return $this->localizedSort($entities);
+    }
 }
-?>
\ No newline at end of file
index 123249d..bd634e3 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 namespace SJBR\StaticInfoTables\Domain\Repository;
+
 /***************************************************************
 *  Copyright notice
 *
@@ -28,26 +29,26 @@ namespace SJBR\StaticInfoTables\Domain\Repository;
 /**
  * Repository for \SJBR\StaticInfoTables\Domain\Model\Currency
  */
-class CurrencyRepository extends AbstractEntityRepository {
-
-       /**
-        * @var array ISO keys for this static table
-        */
-       protected $isoKeys = array('cu_iso_3');
+class CurrencyRepository extends AbstractEntityRepository
+{
+    /**
+     * @var array ISO keys for this static table
+     */
+    protected $isoKeys = ['cu_iso_3'];
 
-       /**
-        * Finds currency by country
-        *
-        * @param \SJBR\StaticInfoTables\Domain\Model\Country $country
-        *
-        * @return Tx_Extbase_Persistence_QueryResultInterface|array
-        */
-       public function findByCountry(\SJBR\StaticInfoTables\Domain\Model\Country $country) {
-               $query = $this->createQuery();
-               $query->matching(
-                       $query->equals('isoCodeNumber', $country->getCurrencyIsoCodeNumber())
-               );
-               return $query->execute();
-       }
+    /**
+     * Finds currency by country
+     *
+     * @param \SJBR\StaticInfoTables\Domain\Model\Country $country
+     *
+     * @return Tx_Extbase_Persistence_QueryResultInterface|array
+     */
+    public function findByCountry(\SJBR\StaticInfoTables\Domain\Model\Country $country)
+    {
+        $query = $this->createQuery();
+        $query->matching(
+            $query->equals('isoCodeNumber', $country->getCurrencyIsoCodeNumber())
+        );
+        return $query->execute();
+    }
 }
-?>
\ No newline at end of file
index 4edd2df..cb2f4a6 100644 (file)
@@ -27,123 +27,124 @@ namespace SJBR\StaticInfoTables\Domain\Repository;
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
 
+use SJBR\StaticInfoTables\Cache\ClassCacheManager;
+use SJBR\StaticInfoTables\Domain\Model\LanguagePack;
 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Extbase\Persistence\Repository;
 use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
 use TYPO3\CMS\Extensionmanager\Utility\InstallUtility;
-use SJBR\StaticInfoTables\Cache\ClassCacheManager;
-use SJBR\StaticInfoTables\Domain\Model\LanguagePack;
 
 class LanguagePackRepository extends Repository
 {
-       /**
-        * @var string Name of the extension this class belongs to
-        */
-       protected $extensionName = 'StaticInfoTables';
+    /**
+     * @var string Name of the extension this class belongs to
+     */
+    protected $extensionName = 'StaticInfoTables';
 
-       /**
-        * Writes the language pack files
-        *
-        * @param LanguagePack the object to be stored
-        * @return array localized messages
-        */
-       public function writeLanguagePack(LanguagePack $languagePack)
-       {
-               $content = array();
+    /**
+     * Writes the language pack files
+     *
+     * @param LanguagePack the object to be stored
+     *
+     * @return array localized messages
+     */
+    public function writeLanguagePack(LanguagePack $languagePack)
+    {
+        $content = [];
 
-               $extensionKey = GeneralUtility::camelCaseToLowerCaseUnderscored($this->extensionName);
-               $extensionPath = ExtensionManagementUtility::extPath($extensionKey);
+        $extensionKey = GeneralUtility::camelCaseToLowerCaseUnderscored($this->extensionName);
+        $extensionPath = ExtensionManagementUtility::extPath($extensionKey);
 
-               $content = array();
-               $locale = $languagePack->getLocale();
-               $localeLowerCase = strtolower($locale);
-               $localeUpperCase = strtoupper($locale);
-               $localeCamel = GeneralUtility::underscoredToUpperCamelCase(strtolower($locale));
+        $content = [];
+        $locale = $languagePack->getLocale();
+        $localeLowerCase = strtolower($locale);
+        $localeUpperCase = strtoupper($locale);
+        $localeCamel = GeneralUtility::underscoredToUpperCamelCase(strtolower($locale));
 
-               $languagePackExtensionKey = $extensionKey . '_' . $localeLowerCase;
-               $languagePackExtensionPath = (class_exists(\TYPO3\CMS\Core\Core\Environment) ? (\TYPO3\CMS\Core\Core\Environment::getPublicPath() . '/') : PATH_site) . 'typo3conf/ext/' . $languagePackExtensionKey . '/';
+        $languagePackExtensionKey = $extensionKey . '_' . $localeLowerCase;
+        $languagePackExtensionPath = (class_exists(\TYPO3\CMS\Core\Core\Environment) ? (\TYPO3\CMS\Core\Core\Environment::getPublicPath() . '/') : PATH_site) . 'typo3conf/ext/' . $languagePackExtensionKey . '/';
 
-               // Cleanup any pre-existing language pack
-               if (is_dir($languagePackExtensionPath)) {
-                       GeneralUtility::rmdir($languagePackExtensionPath, true);
-               }
-               // Create language pack directory structure
-               if (!is_dir($languagePackExtensionPath)) {
-                       GeneralUtility::mkdir_deep($languagePackExtensionPath);
-               }
-               if (!is_dir($languagePackExtensionPath . 'Classes/Domain/Model/')) {
-                       GeneralUtility::mkdir_deep($languagePackExtensionPath . 'Classes/Domain/Model/');
-               }
-               if (!is_dir($languagePackExtensionPath . 'Configuration/DomainModelExtension/')) {
-                       GeneralUtility::mkdir_deep($languagePackExtensionPath . 'Configuration/DomainModelExtension/');
-               }
-               if (!is_dir($languagePackExtensionPath . 'Configuration/TCA/Overrides/')) {
-                       GeneralUtility::mkdir_deep($languagePackExtensionPath . 'Configuration/TCA/Overrides/');
-               }
-               if (!is_dir($languagePackExtensionPath . 'Configuration/PageTSconfig/')) {
-                       GeneralUtility::mkdir_deep($languagePackExtensionPath . 'Configuration/PageTSconfig/');
-               }
-               if (!is_dir($languagePackExtensionPath . 'Configuration/TypoScript/Extbase/')) {
-                       GeneralUtility::mkdir_deep($languagePackExtensionPath . 'Configuration/TypoScript/Extbase/');
-               }
-               if (!is_dir($languagePackExtensionPath . 'Resources/Private/Language/')) {
-                       GeneralUtility::mkdir_deep($languagePackExtensionPath . 'Resources/Private/Language/');
-               }
-               if (!is_dir($languagePackExtensionPath . 'Resources/Public/Icons/')) {
-                       GeneralUtility::mkdir_deep($languagePackExtensionPath . 'Resources/Public/Icons/');
-               }
+        // Cleanup any pre-existing language pack
+        if (is_dir($languagePackExtensionPath)) {
+            GeneralUtility::rmdir($languagePackExtensionPath, true);
+        }
+        // Create language pack directory structure
+        if (!is_dir($languagePackExtensionPath)) {
+            GeneralUtility::mkdir_deep($languagePackExtensionPath);
+        }
+        if (!is_dir($languagePackExtensionPath . 'Classes/Domain/Model/')) {
+            GeneralUtility::mkdir_deep($languagePackExtensionPath . 'Classes/Domain/Model/');
+        }
+        if (!is_dir($languagePackExtensionPath . 'Configuration/DomainModelExtension/')) {
+            GeneralUtility::mkdir_deep($languagePackExtensionPath . 'Configuration/DomainModelExtension/');
+        }
+        if (!is_dir($languagePackExtensionPath . 'Configuration/TCA/Overrides/')) {
+            GeneralUtility::mkdir_deep($languagePackExtensionPath . 'Configuration/TCA/Overrides/');
+        }
+        if (!is_dir($languagePackExtensionPath . 'Configuration/PageTSconfig/')) {
+            GeneralUtility::mkdir_deep($languagePackExtensionPath . 'Configuration/PageTSconfig/');
+        }
+        if (!is_dir($languagePackExtensionPath . 'Configuration/TypoScript/Extbase/')) {
+            GeneralUtility::mkdir_deep($languagePackExtensionPath . 'Configuration/TypoScript/Extbase/');
+        }
+        if (!is_dir($languagePackExtensionPath . 'Resources/Private/Language/')) {
+            GeneralUtility::mkdir_deep($languagePackExtensionPath . 'Resources/Private/Language/');
+        }
+        if (!is_dir($languagePackExtensionPath . 'Resources/Public/Icons/')) {
+            GeneralUtility::mkdir_deep($languagePackExtensionPath . 'Resources/Public/Icons/');
+        }
 
-               // Get the source files of the language pack template
-               $sourcePath = $extensionPath . 'Resources/Private/LanguagePackTemplate/';
-               $sourceFiles = [];
-               $sourceFiles = GeneralUtility::getAllFilesAndFoldersInPath($sourceFiles, $sourcePath);
-               $sourceFiles = GeneralUtility::removePrefixPathFromList($sourceFiles, $sourcePath);
-               // Set markers replacement values
-               $replace = array (
-                       '###LANG_ISO_LOWER###' => $localeLowerCase,
-                       '###LANG_ISO_UPPER###' => $localeUpperCase,
-                       '###LANG_ISO_CAMEL###' => $localeCamel,
-                       '###TYPO3_VERSION_RANGE###' => $languagePack->getTypo3VersionRange(),
-                       '###VERSION###' => $languagePack->getVersion(),
-                       '###LANG_NAME###' => $languagePack->getLanguage(),
-                       '###AUTHOR###' => $languagePack->getAuthor(),
-                       '###AUTHOR_EMAIL###' => $languagePack->getAuthorEmail(),
-                       '###AUTHOR_COMPANY###' => $languagePack->getAuthorCompany(),
-                       '###VERSION_BASE###' => $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$extensionKey]['version'],
-                       '###LANG_TCA_LABELS###' => $languagePack->getLocalizationLabels(),
-                       '###LANG_SQL_UPDATE###' => $languagePack->getUpdateQueries()
-               );
-               // Create the language pack files
-               $success = true;
-               foreach ($sourceFiles as $hash => $file) {
-                       $fileContent = GeneralUtility::getUrl($sourcePath . $file);
-                       foreach ($replace as $marker => $replacement) {
-                               $fileContent = str_replace($marker, $replacement, $fileContent);
-                       }
-                       $success = GeneralUtility::writeFile($languagePackExtensionPath . str_replace('.code', '.php', $file), $fileContent);
-                       if (!$success) {
-                               $content[] = LocalizationUtility::translate('couldNotWriteFile', $this->extensionName) . ' ' . $languagePackExtensionPath . $file;
-                               break;
-                       }
-               }
-               if ($success) {
-                       $classCacheManager = $this->objectManager->get(ClassCacheManager::class);
-                       $installUtility = $this->objectManager->get(InstallUtility::class);
-                       $installed = ExtensionManagementUtility::isLoaded($languagePackExtensionKey);
-                       if ($installed) {
-                               $content[] =  LocalizationUtility::translate('languagePack', $this->extensionName)
-                                       . ' ' . $languagePackExtensionKey
-                                       . ' ' . LocalizationUtility::translate('languagePackUpdated', $this->extensionName);
-                       } else {
-                               $content[] = LocalizationUtility::translate('languagePackCreated', $this->extensionName) . ' ' . $languagePack->getLanguage() . ' (' . $locale . ')';
-                               $installUtility->install($languagePackExtensionKey);
-                               $content[] = LocalizationUtility::translate('languagePack', $this->extensionName)
-                                       . ' ' . $languagePackExtensionKey
-                                       . ' ' . LocalizationUtility::translate('wasInstalled', $this->extensionName);
-                       }
-                       $classCacheManager->reBuild();
-               }
-               return $content;
-       }
-}
\ No newline at end of file
+        // Get the source files of the language pack template
+        $sourcePath = $extensionPath . 'Resources/Private/LanguagePackTemplate/';
+        $sourceFiles = [];
+        $sourceFiles = GeneralUtility::getAllFilesAndFoldersInPath($sourceFiles, $sourcePath);
+        $sourceFiles = GeneralUtility::removePrefixPathFromList($sourceFiles, $sourcePath);
+        // Set markers replacement values
+        $replace = [
+            '###LANG_ISO_LOWER###' => $localeLowerCase,
+            '###LANG_ISO_UPPER###' => $localeUpperCase,
+            '###LANG_ISO_CAMEL###' => $localeCamel,
+            '###TYPO3_VERSION_RANGE###' => $languagePack->getTypo3VersionRange(),
+            '###VERSION###' => $languagePack->getVersion(),
+            '###LANG_NAME###' => $languagePack->getLanguage(),
+            '###AUTHOR###' => $languagePack->getAuthor(),
+            '###AUTHOR_EMAIL###' => $languagePack->getAuthorEmail(),
+            '###AUTHOR_COMPANY###' => $languagePack->getAuthorCompany(),
+            '###VERSION_BASE###' => $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$extensionKey]['version'],
+            '###LANG_TCA_LABELS###' => $languagePack->getLocalizationLabels(),
+            '###LANG_SQL_UPDATE###' => $languagePack->getUpdateQueries(),
+        ];
+        // Create the language pack files
+        $success = true;
+        foreach ($sourceFiles as $hash => $file) {
+            $fileContent = GeneralUtility::getUrl($sourcePath . $file);
+            foreach ($replace as $marker => $replacement) {
+                $fileContent = str_replace($marker, $replacement, $fileContent);
+            }
+            $success = GeneralUtility::writeFile($languagePackExtensionPath . str_replace('.code', '.php', $file), $fileContent);
+            if (!$success) {
+                $content[] = LocalizationUtility::translate('couldNotWriteFile', $this->extensionName) . ' ' . $languagePackExtensionPath . $file;
+                break;
+            }
+        }
+        if ($success) {
+            $classCacheManager = $this->objectManager->get(ClassCacheManager::class);
+            $installUtility = $this->objectManager->get(InstallUtility::class);
+            $installed = ExtensionManagementUtility::isLoaded($languagePackExtensionKey);
+            if ($installed) {
+                $content[] =  LocalizationUtility::translate('languagePack', $this->extensionName)
+                    . ' ' . $languagePackExtensionKey
+                    . ' ' . LocalizationUtility::translate('languagePackUpdated', $this->extensionName);
+            } else {
+                $content[] = LocalizationUtility::translate('languagePackCreated', $this->extensionName) . ' ' . $languagePack->getLanguage() . ' (' . $locale . ')';
+                $installUtility->install($languagePackExtensionKey);
+                $content[] = LocalizationUtility::translate('languagePack', $this->extensionName)
+                    . ' ' . $languagePackExtensionKey
+                    . ' ' . LocalizationUtility::translate('wasInstalled', $this->extensionName);
+            }
+            $classCacheManager->reBuild();
+        }
+        return $content;
+    }
+}
index 2e3edfe..993134a 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 namespace SJBR\StaticInfoTables\Domain\Repository;
+
 /***************************************************************
 *  Copyright notice
 *
@@ -26,44 +27,44 @@ namespace SJBR\StaticInfoTables\Domain\Repository;
 
 /**
  * Repository for \SJBR\StaticInfoTables\Domain\Model\Language
- *
  */
-class LanguageRepository extends AbstractEntityRepository {
-
-       /**
-        * @var array ISO keys for this static table
-        */
-       protected $isoKeys = array('lg_iso_2', 'lg_country_iso_2');
+class LanguageRepository extends AbstractEntityRepository
+{
+    /**
+     * @var array ISO keys for this static table
+     */
+    protected $isoKeys = ['lg_iso_2', 'lg_country_iso_2'];
 
-       /**
-        * Find all neither constructed nor sacred languages
-        *
-        * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface|array all languages neither constructed nor sacred
-        */
-       public function findAllNonConstructedNonSacred() {
-               $query = $this->createQuery();
-               $query->matching($query->logicalAnd(
-                       $query->equals('constructedLanguage', FALSE),
-                       $query->equals('sacredLanguage', FALSE)
-               ));
-               return $query->execute();                
-       }
+    /**
+     * Find all neither constructed nor sacred languages
+     *
+     * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface|array all languages neither constructed nor sacred
+     */
+    public function findAllNonConstructedNonSacred()
+    {
+        $query = $this->createQuery();
+        $query->matching($query->logicalAnd(
+            $query->equals('constructedLanguage', false),
+            $query->equals('sacredLanguage', false)
+        ));
+        return $query->execute();
+    }
 
-       /**
-        * Find the language object with the specified iso codes
-        *
-        * @param string $languageIsoCodeA2
-        * @param string $countryIsoCodeA2
-        *
-        * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface|array all entries ordered by $propertyName
-        */
-       public function findOneByIsoCodes($languageIsoCodeA2, $countryIsoCodeA2 = '') {
-               $query = $this->createQuery();
-               $query->matching($query->logicalAnd(
-                       $query->equals('isoCodeA2', $languageIsoCodeA2),
-                       $query->equals('countryIsoCodeA2', $countryIsoCodeA2)
-               ));
-               return $query->execute()->getFirst();
-       }
+    /**
+     * Find the language object with the specified iso codes
+     *
+     * @param string $languageIsoCodeA2
+     * @param string $countryIsoCodeA2
+     *
+     * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface|array all entries ordered by $propertyName
+     */
+    public function findOneByIsoCodes($languageIsoCodeA2, $countryIsoCodeA2 = '')
+    {
+        $query = $this->createQuery();
+        $query->matching($query->logicalAnd(
+            $query->equals('isoCodeA2', $languageIsoCodeA2),
+            $query->equals('countryIsoCodeA2', $countryIsoCodeA2)
+        ));
+        return $query->execute()->getFirst();
+    }
 }
-?>
\ No newline at end of file
index ec2f455..45cfaff 100644 (file)
@@ -36,22 +36,22 @@ use TYPO3\CMS\Extbase\Persistence\Repository;
  */
 class SystemLanguageRepository extends Repository
 {
-       /**
-        * Find all system language objects with uid in list
-        * If no list is provided, find all system language objects
-        *
-        * @param string $list: list of uid's
-        * @return QueryResultInterface|array all entries
-        */
-       public function findAllByUidInList($list = '')
-       {
-               if (empty($list)) {
-                       return $this->findAll();
-               } else {
-                       $query = $this->createQuery();
-                       $list = GeneralUtility::trimExplode(',', $list, true);
-                       $query->matching($query->in('uid', $list));
-                       return $query->execute();
-               }
-       }
-}
\ No newline at end of file
+    /**
+     * Find all system language objects with uid in list
+     * If no list is provided, find all system language objects
+     *
+     * @param string $list: list of uid's
+     *
+     * @return QueryResultInterface|array all entries
+     */
+    public function findAllByUidInList($list = '')
+    {
+        if (empty($list)) {
+            return $this->findAll();
+        }
+        $query = $this->createQuery();
+        $list = GeneralUtility::trimExplode(',', $list, true);
+        $query->matching($query->in('uid', $list));
+        return $query->execute();
+    }
+}
index e987109..44f4d55 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 namespace SJBR\StaticInfoTables\Domain\Repository;
+
 /***************************************************************
 *  Copyright notice
 *
@@ -27,75 +28,79 @@ namespace SJBR\StaticInfoTables\Domain\Repository;
 /**
  * Repository for \SJBR\StaticInfoTables\Domain\Model\Territory
  */
-class TerritoryRepository extends AbstractEntityRepository {
-
-       /**
-        * ISO keys for this static table
-        * @var array
-        */
-       protected $isoKeys = array('tr_iso_nr');
+class TerritoryRepository extends AbstractEntityRepository
+{
+    /**
+     * ISO keys for this static table
+     *
+     * @var array
+     */
+    protected $isoKeys = ['tr_iso_nr'];
 
-       /**
-        * Finds the territory within which a country is located
-        *
-        * @param \SJBR\StaticInfoTables\Domain\Model\Country $country
-        *
-        * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface|array
-        */
-       public function findByCountry(\SJBR\StaticInfoTables\Domain\Model\Country $country) {
-               $query = $this->createQuery();
-               $query->matching(
-                       $query->equals('unCodeNumber', $country->getParentTerritoryUnCodeNumber())
-               );
-               return $query->execute();
-       }
+    /**
+     * Finds the territory within which a country is located
+     *
+     * @param \SJBR\StaticInfoTables\Domain\Model\Country $country
+     *
+     * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface|array
+     */
+    public function findByCountry(\SJBR\StaticInfoTables\Domain\Model\Country $country)
+    {
+        $query = $this->createQuery();
+        $query->matching(
+            $query->equals('unCodeNumber', $country->getParentTerritoryUnCodeNumber())
+        );
+        return $query->execute();
+    }
 
-       /**
-        * Finds territories that have a given territory as parent territory
-        *
-        * @param \SJBR\StaticInfoTables\Domain\Model\Territory $territory
-        *
-        * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface|array
-        */
-       public function findByTerritory(\SJBR\StaticInfoTables\Domain\Model\Territory $territory) {
-               $query = $this->createQuery();
-               $query->matching(
-                       $query->equals('parentTerritoryUnCodeNumber', $territory->getUnCodeNumber())
-               );
-               return $query->execute();
-       }
+    /**
+     * Finds territories that have a given territory as parent territory
+     *
+     * @param \SJBR\StaticInfoTables\Domain\Model\Territory $territory
+     *
+     * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface|array
+     */
+    public function findByTerritory(\SJBR\StaticInfoTables\Domain\Model\Territory $territory)
+    {
+        $query = $this->createQuery();
+        $query->matching(
+            $query->equals('parentTerritoryUnCodeNumber', $territory->getUnCodeNumber())
+        );
+        return $query->execute();
+    }
 
-       /**
-        * Finds all territories within a territory recursively
-        *
-        * @param \SJBR\StaticInfoTables\Domain\Model\Territory $territory
-        * @param array $unCodeNumbers array of UN territory code numbers used for recursive retrieval of sub-territories
-        *
-        * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface|array
-        */
-       public function findWithinTerritory(\SJBR\StaticInfoTables\Domain\Model\Territory $territory, &$unCodeNumbers = array()) {
-               if (empty($unCodeNumbers)) {
-                       $unCodeNumbers = array($territory->getUnCodeNumber());
-               }
-               $initialCount = count($unCodeNumbers);
+    /**
+     * Finds all territories within a territory recursively
+     *
+     * @param \SJBR\StaticInfoTables\Domain\Model\Territory $territory
+     * @param array $unCodeNumbers array of UN territory code numbers used for recursive retrieval of sub-territories
+     *
+     * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface|array
+     */
+    public function findWithinTerritory(\SJBR\StaticInfoTables\Domain\Model\Territory $territory, &$unCodeNumbers = [])
+    {
+        if (empty($unCodeNumbers)) {
+            $unCodeNumbers = [$territory->getUnCodeNumber()];
+        }
+        $initialCount = count($unCodeNumbers);
 
-               $query = $this->createQuery();
-               $query->matching(
-                       $query->in('parentTerritoryUnCodeNumber', $unCodeNumbers)
-               );
-               $territories = $query->execute();
+        $query = $this->createQuery();
+        $query->matching(
+            $query->in('parentTerritoryUnCodeNumber', $unCodeNumbers)
+        );
+        $territories = $query->execute();
 
-               // Get UN code numbers of new subterritories
-               foreach ($territories as $subterritory) {
-                       $unCodeNumbers[] = $subterritory->getUnCodeNumber();
-               }
-               $unCodeNumbers = array_unique($unCodeNumbers);
+        // Get UN code numbers of new subterritories
+        foreach ($territories as $subterritory) {
+            $unCodeNumbers[] = $subterritory->getUnCodeNumber();
+        }
+        $unCodeNumbers = array_unique($unCodeNumbers);
 
-               // Call recursively until no additional subterritories are found
-               if (count($unCodeNumbers) > $initialCount) {
-                       $territories = $this->findWithinTerritory($territory, $unCodeNumbers);
-               }
+        // Call recursively until no additional subterritories are found
+        if (count($unCodeNumbers) > $initialCount) {
+            $territories = $this->findWithinTerritory($territory, $unCodeNumbers);
+        }
 
-               return $territories;
-       }
-}
\ No newline at end of file
+        return $territories;
+    }
+}
index 95125d9..26ecf69 100644 (file)
@@ -23,42 +23,38 @@ namespace SJBR\StaticInfoTables\Hook\Backend\Form\FormDataProvider;
  *  This copyright notice MUST APPEAR in all copies of the script!
  */
 
-use SJBR\StaticInfoTables\Domain\Model\Country;
-use SJBR\StaticInfoTables\Domain\Model\Currency;
-use SJBR\StaticInfoTables\Domain\Model\Language;
-use SJBR\StaticInfoTables\Domain\Model\Territory;
 use SJBR\StaticInfoTables\Utility\LocalizationUtility;
 use TYPO3\CMS\Backend\Form\Wizard\SuggestWizardDefaultReceiver;
-use TYPO3\CMS\Core\Utility\GeneralUtility;
 
 /**
  * Processor for suggest items
  */
 class SuggestLabelProcessor
 {
-       /**
-        * Translate label of entity in suggest selector
-        *
-        * @param array $params: table, uid, row, entry
-        * @param SuggestWizardDefaultReceiver $parentObj
-        * @return void
-        */
-       public function translateLabel(array &$params, SuggestWizardDefaultReceiver $parentObj)
-       {
-               $path = $params['entry']['path'];
-               if (mb_strlen($path, 'utf-8') > 30) {
-                       $croppedPath = '<abbr title="' . htmlspecialchars($path) . '">' .
-                               htmlspecialchars(
-                                       mb_substr($path, 0, 10, 'utf-8')
-                                               . '...'
-                                               . mb_substr($path, -20, null, 'utf-8')
-                               ) .
-                               '</abbr>';
-               } else {
-                       $croppedPath = htmlspecialchars($path);
-               }
-               $label = LocalizationUtility::translate(['uid' => $params['uid']], $params['table']);
-               $params['entry']['text'] = '<span class="suggest-label">' . $label . '</span><span class="suggest-uid">[' . $params['uid'] . ']</span><br />
+    /**
+     * Translate label of entity in suggest selector
+     *
+     * @param array $params: table, uid, row, entry
+     * @param SuggestWizardDefaultReceiver $parentObj
+     *
+     * @return void
+     */
+    public function translateLabel(array &$params, SuggestWizardDefaultReceiver $parentObj)
+    {
+        $path = $params['entry']['path'];
+        if (mb_strlen($path, 'utf-8') > 30) {
+            $croppedPath = '<abbr title="' . htmlspecialchars($path) . '">' .
+                htmlspecialchars(
+                    mb_substr($path, 0, 10, 'utf-8')
+                        . '...'
+                        . mb_substr($path, -20, null, 'utf-8')
+                ) .
+                '</abbr>';
+        } else {
+            $croppedPath = htmlspecialchars($path);
+        }
+        $label = LocalizationUtility::translate(['uid' => $params['uid']], $params['table']);
+        $params['entry']['text'] = '<span class="suggest-label">' . $label . '</span><span class="suggest-uid">[' . $params['uid'] . ']</span><br />
                                                                <span class="suggest-path">' . $croppedPath . '</span>';
-       }
-}
\ No newline at end of file
+    }
+}
index fe9e592..093e051 100644 (file)
@@ -35,95 +35,96 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
  */
 class TcaLabelProcessor
 {
-       /**
-        * Add ISO codes to the label of entities
-        *
-        * @param array $PA: parameters: items, config, TSconfig, table, row, field
-        * @param DataPreprocessor $fObj
-        * @return void
-        */
-       public function addIsoCodeToLabel(&$PA)
-       {
-               if (\TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getNumericTypo3Version()) < 8000000) {
-                       $PA['title'] = $PA['row'][$GLOBALS['TCA'][$PA['table']]['ctrl']['label']];
-               } else {
-                       $PA['title'] = LocalizationUtility::translate(['uid' => $PA['row']['uid']], $PA['table']);
-               }
-               if (TYPO3_MODE == 'BE') {
-                       /** @var $objectManager \TYPO3\CMS\Extbase\Object\ObjectManager */
-                       $objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
-                       switch ($PA['table']) {
-                               case 'static_territories':
-                                       $isoCode = $PA['row']['tr_iso_nr'];
-                                       if (!$isoCode) {
-                                               /** @var $territoryRepository SJBR\StaticInfoTables\Domain\Repository\TerritoryRepository */
-                                               $territoryRepository = $objectManager->get('SJBR\\StaticInfoTables\\Domain\\Repository\\TerritoryRepository');
-                                               /** @var $territory SJBR\StaticInfoTables\Domain\Model\Territory */
-                                               $territory = $territoryRepository->findByUid($PA['row']['uid']);
-                                               if ($territory instanceof Territory) {
-                                                       $isoCode = $territory->getUnCodeNumber();
-                                               }
-                                       }
-                                       if ($isoCode) {
-                                               $PA['title'] = $PA['title'] . ' (' . $isoCode . ')';
-                                       }
-                                       break;
-                               case 'static_countries':
-                                       $isoCode = $PA['row']['cn_iso_2'];
-                                       if (!$isoCode) {
-                                               /** @var $countryRepository SJBR\StaticInfoTables\Domain\Repository\CountryRepository */
-                                               $countryRepository = $objectManager->get('SJBR\\StaticInfoTables\\Domain\\Repository\\CountryRepository');
-                                               /** @var $country SJBR\StaticInfoTables\Domain\Model\Country */
-                                               $country = $countryRepository->findByUid($PA['row']['uid']);
-                                               if ($country instanceof Country) {
-                                                       $isoCode = $country->getIsoCodeA2();
-                                               }
-                                       }
-                                       if ($isoCode) {
-                                               $PA['title'] = $PA['title'] . ' (' . $isoCode . ')';
-                                       }
-                                       break;
-                               case 'static_languages':
-                                       $isoCodes = array($PA['row']['lg_iso_2']);
-                                       if ($PA['row']['lg_country_iso_2']) {
-                                               $isoCodes[] = $PA['row']['lg_country_iso_2'];
-                                       }
-                                       $isoCode = implode('_', $isoCodes);
-                                       if (!$isoCode || !$PA['row']['lg_country_iso_2']) {
-                                               /** @var $languageRepository SJBR\StaticInfoTables\Domain\Repository\LanguageRepository */
-                                               $languageRepository = $objectManager->get('SJBR\\StaticInfoTables\\Domain\\Repository\\LanguageRepository');
-                                               /** @var $language SJBR\StaticInfoTables\Domain\Model\Language */
-                                               $language = $languageRepository->findByUid($PA['row']['uid']);
-                                               if ($language instanceof Language) {
-                                                       $isoCodes = array($language->getIsoCodeA2());
-                                                       if ($language->getCountryIsoCodeA2()) {
-                                                               $isoCodes[] = $language->getCountryIsoCodeA2();
-                                                       }
-                                                       $isoCode = implode('_', $isoCodes);
-                                               }
-                                       }
-                                       if ($isoCode) {
-                                               $PA['title'] = $PA['title'] . ' (' . $isoCode . ')';
-                                       }
-                                       break;
-                               case 'static_currencies':
-                                       $isoCode = $PA['row']['cu_iso_3'];
-                                       if (!$isoCode) {
-                                               /** @var $currencyRepository SJBR\StaticInfoTables\Domain\Repository\CurrencyRepository */
-                                               $currencyRepository = $objectManager->get('SJBR\\StaticInfoTables\\Domain\\Repository\\CurrencyRepository');
-                                               /** @var $currency SJBR\StaticInfoTables\Domain\Model\Currency */
-                                               $currency = $currencyRepository->findByUid($PA['row']['uid']);
-                                               if ($currency instanceof Currency) {
-                                                       $isoCode = $currency->getIsoCodeA3();
-                                               }
-                                       }
-                                       if ($isoCode) {
-                                               $PA['title'] = $PA['title'] . ' (' . $isoCode . ')';
-                                       }
-                                       break;
-                               default:
-                                       break;
-                       }
-               }
-       }
-}
\ No newline at end of file
+    /**
+     * Add ISO codes to the label of entities
+     *
+     * @param array $PA: parameters: items, config, TSconfig, table, row, field
+     * @param DataPreprocessor $fObj
+     *
+     * @return void
+     */
+    public function addIsoCodeToLabel(&$PA)
+    {
+        if (\TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getNumericTypo3Version()) < 8000000) {
+            $PA['title'] = $PA['row'][$GLOBALS['TCA'][$PA['table']]['ctrl']['label']];
+        } else {
+            $PA['title'] = LocalizationUtility::translate(['uid' => $PA['row']['uid']], $PA['table']);
+        }
+        if (TYPO3_MODE == 'BE') {
+            /** @var $objectManager \TYPO3\CMS\Extbase\Object\ObjectManager */
+            $objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
+            switch ($PA['table']) {
+                case 'static_territories':
+                    $isoCode = $PA['row']['tr_iso_nr'];
+                    if (!$isoCode) {
+                        /** @var $territoryRepository SJBR\StaticInfoTables\Domain\Repository\TerritoryRepository */
+                        $territoryRepository = $objectManager->get('SJBR\\StaticInfoTables\\Domain\\Repository\\TerritoryRepository');
+                        /** @var $territory SJBR\StaticInfoTables\Domain\Model\Territory */
+                        $territory = $territoryRepository->findByUid($PA['row']['uid']);
+                        if ($territory instanceof Territory) {
+                            $isoCode = $territory->getUnCodeNumber();
+                        }
+                    }
+                    if ($isoCode) {
+                        $PA['title'] = $PA['title'] . ' (' . $isoCode . ')';
+                    }
+                    break;
+                case 'static_countries':
+                    $isoCode = $PA['row']['cn_iso_2'];
+                    if (!$isoCode) {
+                        /** @var $countryRepository SJBR\StaticInfoTables\Domain\Repository\CountryRepository */
+                        $countryRepository = $objectManager->get('SJBR\\StaticInfoTables\\Domain\\Repository\\CountryRepository');
+                        /** @var $country SJBR\StaticInfoTables\Domain\Model\Country */
+                        $country = $countryRepository->findByUid($PA['row']['uid']);
+                        if ($country instanceof Country) {
+                            $isoCode = $country->getIsoCodeA2();
+                        }
+                    }
+                    if ($isoCode) {
+                        $PA['title'] = $PA['title'] . ' (' . $isoCode . ')';
+                    }
+                    break;
+                case 'static_languages':
+                    $isoCodes = [$PA['row']['lg_iso_2']];
+                    if ($PA['row']['lg_country_iso_2']) {
+                        $isoCodes[] = $PA['row']['lg_country_iso_2'];
+                    }
+                    $isoCode = implode('_', $isoCodes);
+                    if (!$isoCode || !$PA['row']['lg_country_iso_2']) {
+                        /** @var $languageRepository SJBR\StaticInfoTables\Domain\Repository\LanguageRepository */
+                        $languageRepository = $objectManager->get('SJBR\\StaticInfoTables\\Domain\\Repository\\LanguageRepository');
+                        /** @var $language SJBR\StaticInfoTables\Domain\Model\Language */
+                        $language = $languageRepository->findByUid($PA['row']['uid']);
+                        if ($language instanceof Language) {
+                            $isoCodes = [$language->getIsoCodeA2()];
+                            if ($language->getCountryIsoCodeA2()) {
+                                $isoCodes[] = $language->getCountryIsoCodeA2();
+                            }
+                            $isoCode = implode('_', $isoCodes);
+                        }
+                    }
+                    if ($isoCode) {
+                        $PA['title'] = $PA['title'] . ' (' . $isoCode . ')';
+                    }
+                    break;
+                case 'static_currencies':
+                    $isoCode = $PA['row']['cu_iso_3'];
+                    if (!$isoCode) {
+                        /** @var $currencyRepository SJBR\StaticInfoTables\Domain\Repository\CurrencyRepository */
+                        $currencyRepository = $objectManager->get('SJBR\\StaticInfoTables\\Domain\\Repository\\CurrencyRepository');
+                        /** @var $currency SJBR\StaticInfoTables\Domain\Model\Currency */
+                        $currency = $currencyRepository->findByUid($PA['row']['uid']);
+                        if ($currency instanceof Currency) {
+                            $isoCode = $currency->getIsoCodeA3();
+                        }
+                    }
+                    if ($isoCode) {
+                        $PA['title'] = $PA['title'] . ' (' . $isoCode . ')';
+                    }
+                    break;
+                default:
+                    break;
+            }
+        }
+    }
+}
index d57f80b..c89a515 100644 (file)
@@ -26,212 +26,228 @@ namespace SJBR\StaticInfoTables\Hook\Backend\Form\FormDataProvider;
 /**
  * Processor for TCA select items
  */
-
-use SJBR\StaticInfoTables\Utility\ModelUtility;
 use SJBR\StaticInfoTables\Utility\LocalizationUtility;
+use SJBR\StaticInfoTables\Utility\ModelUtility;
 use TYPO3\CMS\Backend\Form\FormDataProvider\TcaSelectItems;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 
-class TcaSelectItemsProcessor {
-
-       /**
-        * Translate and sort the territories selector using the current locale
-        *
-        * @param array $PA: parameters: items, config, TSconfig, table, row, field
-        * @param DataPreprocessor $fObj
-        * @return void
-        */
-       public function translateTerritoriesSelector($PA, TcaSelectItems $fObj) {
-               switch ($PA['table']) {
-                       case 'static_territories':
-                               // Avoid circular relation
-                               $row = $PA['row'];
-                               foreach ($PA['items'] as $index => $item) {
-                                       if ($item[1] == $row['uid']) {
-                                               unset($PA['items'][$index]);
-                                       }
-                               }
-                               break;
-               }
-               $PA['items'] = $this->translateSelectorItems($PA['items'], 'static_territories');
-               $PA['items'] = $this->replaceSelectorIndexField($PA);
-       }
-
-       /**
-        * Translate and sort the countries selector using the current locale
-        *
-        * @param array $PA: parameters: items, config, TSconfig, table, row, field
-        * @param DataPreprocessor $fObj
-        * @return void
-        */
-       public function translateCountriesSelector($PA, TcaSelectItems $fObj) {
-               $PA['items'] = $this->translateSelectorItems($PA['items'], 'static_countries');
-               $PA['items'] = $this->replaceSelectorIndexField($PA);
-       }
+class TcaSelectItemsProcessor
+{
+    /**
+     * Translate and sort the territories selector using the current locale
+     *
+     * @param array $PA: parameters: items, config, TSconfig, table, row, field
+     * @param DataPreprocessor $fObj
+     *
+     * @return void
+     */
+    public function translateTerritoriesSelector($PA, TcaSelectItems $fObj)
+    {
+        switch ($PA['table']) {
+            case 'static_territories':
+                // Avoid circular relation
+                $row = $PA['row'];
+                foreach ($PA['items'] as $index => $item) {
+                    if ($item[1] == $row['uid']) {
+                        unset($PA['items'][$index]);
+                    }
+                }
+                break;
+        }
+        $PA['items'] = $this->translateSelectorItems($PA['items'], 'static_territories');
+        $PA['items'] = $this->replaceSelectorIndexField($PA);
+    }
 
-       /**
-        * Translate and sort the country zones selector using the current locale
-        *
-        * @param array $PA: parameters: items, config, TSconfig, table, row, field
-        * @param DataPreprocessor $fObj
-        * @return void
-        */
-       public function translateCountryZonesSelector($PA, TcaSelectItems $fObj) {
-               $PA['items'] = $this->translateSelectorItems($PA['items'], 'static_country_zones');
-               $PA['items'] = $this->replaceSelectorIndexField($PA);
-       }
+    /**
+     * Translate and sort the countries selector using the current locale
+     *
+     * @param array $PA: parameters: items, config, TSconfig, table, row, field
+     * @param DataPreprocessor $fObj
+     *
+     * @return void
+     */
+    public function translateCountriesSelector($PA, TcaSelectItems $fObj)
+    {
+        $PA['items'] = $this->translateSelectorItems($PA['items'], 'static_countries');
+        $PA['items'] = $this->replaceSelectorIndexField($PA);
+    }
 
-       /**
-        * Translate and sort the currencies selector using the current locale
-        *
-        * @param array $PA: parameters: items, config, TSconfig, table, row, field
-        * @param DataPreprocessor $fObj
-        * @return void
-        */
-       public function translateCurrenciesSelector($PA, TcaSelectItems $fObj) {
-               $PA['items'] = $this->translateSelectorItems($PA['items'], 'static_currencies');
-               $PA['items'] = $this->replaceSelectorIndexField($PA);
-       }
+    /**
+     * Translate and sort the country zones selector using the current locale
+     *
+     * @param array $PA: parameters: items, config, TSconfig, table, row, field
+     * @param DataPreprocessor $fObj
+     *
+     * @return void
+     */
+    public function translateCountryZonesSelector($PA, TcaSelectItems $fObj)
+    {
+        $PA['items'] = $this->translateSelectorItems($PA['items'], 'static_country_zones');
+        $PA['items'] = $this->replaceSelectorIndexField($PA);
+    }
 
-       /**
-        * Translate and sort the languages selector using the current locale
-        *
-        * @param array $PA: parameters: items, config, TSconfig, table, row, field
-        * @param DataPreprocessor $fObj
-        * @return void
-        */
-       public function translateLanguagesSelector($PA, TcaSelectItems $fObj) {
+    /**
+     * Translate and sort the currencies selector using the current locale
+     *
+     * @param array $PA: parameters: items, config, TSconfig, table, row, field
+     * @param DataPreprocessor $fObj
+     *
+     * @return void
+     */
+    public function translateCurrenciesSelector($PA, TcaSelectItems $fObj)
+    {
+        $PA['items'] = $this->translateSelectorItems($PA['items'], 'static_currencies');
+        $PA['items'] = $this->replaceSelectorIndexField($PA);
+    }
 
-               $PA['items'] = $this->translateSelectorItems($PA['items'], 'static_languages');
-               $PA['items'] = $this->replaceSelectorIndexField($PA);
-       }
+    /**
+     * Translate and sort the languages selector using the current locale
+     *
+     * @param array $PA: parameters: items, config, TSconfig, table, row, field
+     * @param DataPreprocessor $fObj
+     *
+     * @return void
+     */
+    public function translateLanguagesSelector($PA, TcaSelectItems $fObj)
+    {
+        $PA['items'] = $this->translateSelectorItems($PA['items'], 'static_languages');
+        $PA['items'] = $this->replaceSelectorIndexField($PA);
+    }
 
-       /**
-        * Translate selector items array
-        *
-        * @param array $items: array of value/label pairs
-        * @param string $tableName: name of static info tables
-        * @return array array of value/translated label pairs
-        */
-       protected function translateSelectorItems($items, $tableName) {
-               $translatedItems = $items;
-               if (isset($translatedItems) && is_array($translatedItems)) {
-                       foreach ($translatedItems as $key => $item) {
-                               if ($translatedItems[$key][1]) {
-                                       //Get isocode if present
-                                       $code = strstr($item[0], '(');
-                                       $code2 = strstr(substr($code, 1), '(');
-                                       $code = $code2 ? $code2 : $code;
-                                       // Translate
-                                       $translatedItems[$key][0] = LocalizationUtility::translate(array('uid' => $item[1]), $tableName);
-                                       // Re-append isocode, if present
-                                       $translatedItems[$key][0] = $translatedItems[$key][0] . ($code ? ' ' . $code : '');
-                               }
-                       }
-                       $currentLocale = setlocale(LC_COLLATE, '0');
-                       $locale = LocalizationUtility::setCollatingLocale();
-                       if ($locale !== FALSE) {
-                               uasort($translatedItems, array($this, 'strcollOnLabels'));
-                       }
-                       setlocale(LC_COLLATE, $currentLocale);
-               }
-               $items = $translatedItems;
-               return $items;
-       }
+    /**
+     * Translate selector items array
+     *
+     * @param array $items: array of value/label pairs
+     * @param string $tableName: name of static info tables
+     *
+     * @return array array of value/translated label pairs
+     */
+    protected function translateSelectorItems($items, $tableName)
+    {
+        $translatedItems = $items;
+        if (isset($translatedItems) && is_array($translatedItems)) {
+            foreach ($translatedItems as $key => $item) {
+                if ($translatedItems[$key][1]) {
+                    //Get isocode if present
+                    $code = strstr($item[0], '(');
+                    $code2 = strstr(substr($code, 1), '(');
+                    $code = $code2 ? $code2 : $code;
+                    // Translate
+                    $translatedItems[$key][0] = LocalizationUtility::translate(['uid' => $item[1]], $tableName);
+                    // Re-append isocode, if present
+                    $translatedItems[$key][0] = $translatedItems[$key][0] . ($code ? ' ' . $code : '');
+                }
+            }
+            $currentLocale = setlocale(LC_COLLATE, '0');
+            $locale = LocalizationUtility::setCollatingLocale();
+            if ($locale !== false) {
+                uasort($translatedItems, [$this, 'strcollOnLabels']);
+            }
+            setlocale(LC_COLLATE, $currentLocale);
+        }
+        $items = $translatedItems;
+        return $items;
+    }
 
-       /**
-        * Using strcoll comparison on labels
-        *
-        * @return integer see strcoll
-        */
-       protected function strcollOnLabels($itemA, $itemB) {
-               return strcoll($itemA[0], $itemB[0]);
-       }
+    /**
+     * Using strcoll comparison on labels
+     *
+     * @return int see strcoll
+     *
+     * @param mixed $itemA
+     * @param mixed $itemB
+     */
+    protected function strcollOnLabels($itemA, $itemB)
+    {
+        return strcoll($itemA[0], $itemB[0]);
+    }
 
-       /**
-        * Replace the selector's uid index with configured indexField
-        *
-        * @param array  $PA: TCA select field parameters array
-        * @return array The new $items array
-        */
-       protected function replaceSelectorIndexField($PA) {
-               $items = $PA['items'];
-               $indexFields = GeneralUtility::trimExplode(',', $PA['config']['itemsProcFunc_config']['indexField'], TRUE);
-               if (!empty($indexFields)) {
-                       $rows = array();
-                       // Collect items uid's
-                       $uids = array();
-                       foreach ($items as $key => $item) {
-                               if ($items[$key][1]) {
-                                       $uids[] = $item[1];
-                               }
-                       }
-                       $uidList = implode(',', $uids);
-                       if (!empty($uidList)) {
-                               /** @var \TYPO3\CMS\Extbase\Object\ObjectManager $objectManager */
-                               $objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
-                               switch ($PA['config']['foreign_table']) {
-                                       case 'static_territories':
-                                               /** @var $territoryRepository SJBR\StaticInfoTables\Domain\Repository\TerritoryRepository */
-                                               $territoryRepository = $objectManager->get('SJBR\\StaticInfoTables\\Domain\\Repository\\TerritoryRepository');
-                                               $objects = $territoryRepository->findAllByUidInList($uidList)->toArray();
-                                               $columnsMapping = ModelUtility::getModelMapping('SJBR\\StaticInfoTables\\Domain\\Model\\Territory', ModelUtility::MAPPING_COLUMNS);
-                                               break;
-                                       case 'static_countries':
-                                               /** @var $countryRepository SJBR\StaticInfoTables\Domain\Repository\CountryRepository */
-                                               $countryRepository = $objectManager->get('SJBR\\StaticInfoTables\\Domain\\Repository\\CountryRepository');
-                                               $objects = $countryRepository->findAllByUidInList($uidList)->toArray();
-                                               $columnsMapping = ModelUtility::getModelMapping('SJBR\\StaticInfoTables\\Domain\\Model\\Country', ModelUtility::MAPPING_COLUMNS);
-                                               break;
-                                       case 'static_country_zones':
-                                               /** @var $countryZoneRepository SJBR\StaticInfoTables\Domain\Repository\CountryZoneRepository */
-                                               $countryZoneRepository = $objectManager->get('SJBR\\StaticInfoTables\\Domain\\Repository\\CountryZoneRepository');
-                                               $objects = $countryZoneRepository->findAllByUidInList($uidList)->toArray();
-                                               $columnsMapping = ModelUtility::getModelMapping('SJBR\\StaticInfoTables\\Domain\\Model\\CountryZone', ModelUtility::MAPPING_COLUMNS);
-                                               break;                                  
-                                       case 'static_languages':
-                                               /** @var $languageRepository SJBR\StaticInfoTables\Domain\Repository\LanguageRepository */
-                                               $languageRepository = $objectManager->get('SJBR\\StaticInfoTables\\Domain\\Repository\\LanguageRepository');
-                                               $objects = $languageRepository->findAllByUidInList($uidList)->toArray();
-                                               $columnsMapping = ModelUtility::getModelMapping('SJBR\\StaticInfoTables\\Domain\\Model\\Language', ModelUtility::MAPPING_COLUMNS);
-                                               break;
-                                       case 'static_currencies':
-                                               /** @var $currencyRepository SJBR\StaticInfoTables\Domain\Repository\CurrencyRepository */
-                                               $currencyRepository = $objectManager->get('SJBR\\StaticInfoTables\\Domain\\Repository\\CurrencyRepository');
-                                               $objects = $currencyRepository->findAllByUidInList($uidList)->toArray();
-                                               $columnsMapping = ModelUtility::getModelMapping('SJBR\\StaticInfoTables\\Domain\\Model\\Currency', ModelUtility::MAPPING_COLUMNS);
-                                               break;
-                                       default:
-                                               break;
-                               }
-                               if (!empty($objects)) {
-                                       // Map table column to object property
-                                       $indexProperties = array();
-                                       foreach ($indexFields as $indexField) {
-                                               if ($columnsMapping[$indexField]['mapOnProperty']) {
-                                                       $indexProperties[] = $columnsMapping[$indexField]['mapOnProperty'];
-                                               } else {
-                                                       $indexProperties[] = GeneralUtility::underscoredToLowerCamelCase($indexField);
-                                               }
-                                       }
-                                       // Index rows by uid
-                                       $uidIndexedRows = array();
-                                       foreach ($objects as $object) {
-                                               $uidIndexedObjects[$object->getUid()] = $object;
-                                       }
-                                       // Replace the items index field
-                                       foreach ($items as $key => $item) {
-                                               if ($items[$key][1]) {
-                                                       $object = $uidIndexedObjects[$items[$key][1]];
-                                                       $items[$key][1] = $object->_getProperty($indexProperties[0]);
-                                                       if ($indexFields[1] && $object->_getProperty($indexProperties[1])) {
-                                                               $items[$key][1] .=  '_' . $object->_getProperty($indexProperties[1]);
-                                                       }
-                                               }
-                                       }                                               
-                               }
-                       }
-               }
-               return $items;
-       }
-}
\ No newline at end of file
+    /**
+     * Replace the selector's uid index with configured indexField
+     *
+     * @param array     $PA: TCA select field parameters array
+     *
+     * @return array The new $items array
+     */
+    protected function replaceSelectorIndexField($PA)
+    {
+        $items = $PA['items'];
+        $indexFields = GeneralUtility::trimExplode(',', $PA['config']['itemsProcFunc_config']['indexField'], true);
+        if (!empty($indexFields)) {
+            $rows = [];
+            // Collect items uid's
+            $uids = [];
+            foreach ($items as $key => $item) {
+                if ($items[$key][1]) {
+                    $uids[] = $item[1];
+                }
+            }
+            $uidList = implode(',', $uids);
+            if (!empty($uidList)) {
+                /** @var \TYPO3\CMS\Extbase\Object\ObjectManager $objectManager */
+                $objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
+                switch ($PA['config']['foreign_table']) {
+                    case 'static_territories':
+                        /** @var $territoryRepository SJBR\StaticInfoTables\Domain\Repository\TerritoryRepository */
+                        $territoryRepository = $objectManager->get('SJBR\\StaticInfoTables\\Domain\\Repository\\TerritoryRepository');
+                        $objects = $territoryRepository->findAllByUidInList($uidList)->toArray();
+                        $columnsMapping = ModelUtility::getModelMapping('SJBR\\StaticInfoTables\\Domain\\Model\\Territory', ModelUtility::MAPPING_COLUMNS);
+                        break;
+                    case 'static_countries':
+                        /** @var $countryRepository SJBR\StaticInfoTables\Domain\Repository\CountryRepository */
+                        $countryRepository = $objectManager->get('SJBR\\StaticInfoTables\\Domain\\Repository\\CountryRepository');
+                        $objects = $countryRepository->findAllByUidInList($uidList)->toArray();
+                        $columnsMapping = ModelUtility::getModelMapping('SJBR\\StaticInfoTables\\Domain\\Model\\Country', ModelUtility::MAPPING_COLUMNS);
+                        break;
+                    case 'static_country_zones':
+                        /** @var $countryZoneRepository SJBR\StaticInfoTables\Domain\Repository\CountryZoneRepository */
+                        $countryZoneRepository = $objectManager->get('SJBR\\StaticInfoTables\\Domain\\Repository\\CountryZoneRepository');
+                        $objects = $countryZoneRepository->findAllByUidInList($uidList)->toArray();
+                        $columnsMapping = ModelUtility::getModelMapping('SJBR\\StaticInfoTables\\Domain\\Model\\CountryZone', ModelUtility::MAPPING_COLUMNS);
+                        break;
+                    case 'static_languages':
+                        /** @var $languageRepository SJBR\StaticInfoTables\Domain\Repository\LanguageRepository */
+                        $languageRepository = $objectManager->get('SJBR\\StaticInfoTables\\Domain\\Repository\\LanguageRepository');
+                        $objects = $languageRepository->findAllByUidInList($uidList)->toArray();
+                        $columnsMapping = ModelUtility::getModelMapping('SJBR\\StaticInfoTables\\Domain\\Model\\Language', ModelUtility::MAPPING_COLUMNS);
+                        break;
+                    case 'static_currencies':
+                        /** @var $currencyRepository SJBR\StaticInfoTables\Domain\Repository\CurrencyRepository */
+                        $currencyRepository = $objectManager->get('SJBR\\StaticInfoTables\\Domain\\Repository\\CurrencyRepository');
+                        $objects = $currencyRepository->findAllByUidInList($uidList)->toArray();
+                        $columnsMapping = ModelUtility::getModelMapping('SJBR\\StaticInfoTables\\Domain\\Model\\Currency', ModelUtility::MAPPING_COLUMNS);
+                        break;
+                    default:
+                        break;
+                }
+                if (!empty($objects)) {
+                    // Map table column to object property
+                    $indexProperties = [];
+                    foreach ($indexFields as $indexField) {
+                        if ($columnsMapping[$indexField]['mapOnProperty']) {
+                            $indexProperties[] = $columnsMapping[$indexField]['mapOnProperty'];
+                        } else {
+                            $indexProperties[] = GeneralUtility::underscoredToLowerCamelCase($indexField);
+                        }
+                    }
+                    // Index rows by uid
+                    $uidIndexedRows = [];
+                    foreach ($objects as $object) {
+                        $uidIndexedObjects[$object->getUid()] = $object;
+                    }
+                    // Replace the items index field
+                    foreach ($items as $key => $item) {
+                        if ($items[$key][1]) {
+                            $object = $uidIndexedObjects[$items[$key][1]];
+                            $items[$key][1] = $object->_getProperty($indexProperties[0]);
+                            if ($indexFields[1] && $object->_getProperty($indexProperties[1])) {
+                                $items[$key][1] .=  '_' . $object->_getProperty($indexProperties[1]);
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        return $items;
+    }
+}
index 6f643cd..a2f8545 100644 (file)
@@ -50,71 +50,72 @@ class SuggestReceiver extends \TYPO3\CMS\Backend\Form\Wizard\SuggestWizardDefaul
      */
     protected function prepareSelectStatement()
     {
-               $expressionBuilder = $this->queryBuilder->expr();
-               $searchWholePhrase = !isset($this->config['searchWholePhrase']) || $this->config['searchWholePhrase'];
-               $searchString = $this->params['value'];
-               $searchUid = (int)$searchString;
-               if ($searchString !== '') {
-                       $likeCondition = ($searchWholePhrase ? '%' : '') . $this->queryBuilder->escapeLikeWildcards($searchString) . '%';
-                       // Get the label field for the current language, if any is available
-                       $lang = LocalizationUtility::getCurrentLanguage();
-                       $lang = LocalizationUtility::getIsoLanguageKey($lang);
-                       $labelFields = LocalizationUtility::getLabelFields($this->table, $lang);
-                       $selectFieldsList = $labelFields[0] . ',' . $this->config['additionalSearchFields'];
-                       $selectFields = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $selectFieldsList, true);
-                       $selectFields = array_unique($selectFields);
-                       $selectParts = $expressionBuilder->orX();
-                       foreach ($selectFields as $field) {
-                               $selectParts->add($expressionBuilder->like($field, $this->queryBuilder->createPositionalParameter($likeCondition)));
-                       }
-                       $searchClause = $expressionBuilder->orX($selectParts);
-                       if ($searchUid > 0 && $searchUid == $searchString) {
-                               $searchClause->add($expressionBuilder->eq('uid', $searchUid));
-                       }
-                       $this->queryBuilder->andWhere($expressionBuilder->orX($searchClause));
-               }
-               if (!empty($this->allowedPages)) {
-                       $pidList = array_map('intval', $this->allowedPages);
-                       if (!empty($pidList)) {
-                               $this->queryBuilder->andWhere(
-                                       $expressionBuilder->in('pid', $pidList)
-                               );
-                       }
-               }
-               // add an additional search condition comment
-               if (isset($this->config['searchCondition']) && $this->config['searchCondition'] !== '') {
-                       $this->queryBuilder->andWhere(QueryHelper::stripLogicalOperatorPrefix($this->config['searchCondition']));
-               }
+        $expressionBuilder = $this->queryBuilder->expr();
+        $searchWholePhrase = !isset($this->config['searchWholePhrase']) || $this->config['searchWholePhrase'];
+        $searchString = $this->params['value'];
+        $searchUid = (int)$searchString;
+        if ($searchString !== '') {
+            $likeCondition = ($searchWholePhrase ? '%' : '') . $this->queryBuilder->escapeLikeWildcards($searchString) . '%';
+            // Get the label field for the current language, if any is available
+            $lang = LocalizationUtility::getCurrentLanguage();
+            $lang = LocalizationUtility::getIsoLanguageKey($lang);
+            $labelFields = LocalizationUtility::getLabelFields($this->table, $lang);
+            $selectFieldsList = $labelFields[0] . ',' . $this->config['additionalSearchFields'];
+            $selectFields = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $selectFieldsList, true);
+            $selectFields = array_unique($selectFields);
+            $selectParts = $expressionBuilder->orX();
+            foreach ($selectFields as $field) {
+                $selectParts->add($expressionBuilder->like($field, $this->queryBuilder->createPositionalParameter($likeCondition)));
+            }
+            $searchClause = $expressionBuilder->orX($selectParts);
+            if ($searchUid > 0 && $searchUid == $searchString) {
+                $searchClause->add($expressionBuilder->eq('uid', $searchUid));
+            }
+            $this->queryBuilder->andWhere($expressionBuilder->orX($searchClause));
+        }
+        if (!empty($this->allowedPages)) {
+            $pidList = array_map('intval', $this->allowedPages);
+            if (!empty($pidList)) {
+                $this->queryBuilder->andWhere(
+                    $expressionBuilder->in('pid', $pidList)
+                );
+            }
+        }
+        // add an additional search condition comment
+        if (isset($this->config['searchCondition']) && $this->config['searchCondition'] !== '') {
+            $this->queryBuilder->andWhere(QueryHelper::stripLogicalOperatorPrefix($this->config['searchCondition']));
+        }
     }
 
-       /**
-        * Prepares the clause by which the result elements are sorted. See description of ORDER BY in
-        * SQL standard for reference.
-        *
-        * @return void
-        */
-       protected function prepareOrderByStatement()
-       {
-               // Get the label field for the current language, if any is available
-               $lang = LocalizationUtility::getCurrentLanguage();
-               $lang = LocalizationUtility::getIsoLanguageKey($lang);
-               $labelFields = LocalizationUtility::getLabelFields($this->table, $lang);
-               if (!empty($labelFields)) {
-                       foreach ($labelFields as $labelField) {
-                               $this->queryBuilder->addOrderBy($labelField);
-                       }
-               } else  if ($GLOBALS['TCA'][$this->table]['ctrl']['label']) {
-                       $this->queryBuilder->addOrderBy($GLOBALS['TCA'][$this->table]['ctrl']['label']);
-               }
-       }
+    /**
+     * Prepares the clause by which the result elements are sorted. See description of ORDER BY in
+     * SQL standard for reference.
+     *
+     * @return void
+     */
+    protected function prepareOrderByStatement()
+    {
+        // Get the label field for the current language, if any is available
+        $lang = LocalizationUtility::getCurrentLanguage();
+        $lang = LocalizationUtility::getIsoLanguageKey($lang);
+        $labelFields = LocalizationUtility::getLabelFields($this->table, $lang);
+        if (!empty($labelFields)) {
+            foreach ($labelFields as $labelField) {
+                $this->queryBuilder->addOrderBy($labelField);
+            }
+        } elseif ($GLOBALS['TCA'][$this->table]['ctrl']['label']) {
+            $this->queryBuilder->addOrderBy($GLOBALS['TCA'][$this->table]['ctrl']['label']);
+        }
+    }
 
-       /**
-        * Manipulate a record before using it to render the selector; may be used to replace a MM-relation etc.
-        *
-        * @param array $row
-        */
-       protected function manipulateRecord(&$row) {
-               // Localize the record
-               $row[$GLOBALS['TCA'][$this->table]['ctrl']['label']] = LocalizationUtility::translate(array('uid' => $row['uid']), $this->table);
-       }
-}
\ No newline at end of file
+    /**
+     * Manipulate a record before using it to render the selector; may be used to replace a MM-relation etc.
+     *
+     * @param array $row
+     */
+    protected function manipulateRecord(&$row)
+    {
+        // Localize the record
+        $row[$GLOBALS['TCA'][$this->table]['ctrl']['label']] = LocalizationUtility::translate(['uid' => $row['uid']], $this->table);
+    }
+}
index 7a48f4c..700d1d6 100644 (file)
@@ -25,7 +25,6 @@ namespace SJBR\StaticInfoTables\Hook\Backend\Recordlist;
 
 use TYPO3\CMS\Core\Database\Query\QueryHelper;
 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
-use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRecordList;
 
 /**
@@ -33,30 +32,31 @@ use TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRecordList;
  */
 class BuildQueryParameters
 {
-       /**
-        * Specify records order
-        *
-        * @param array $parameters
-        * @param string $table
-        * @param int $pageId
-        * @param string $additionalConstraints
-        * @param string $fieldList
-        * @param AbstractDatabaseRecordList $parentObj
-        * @return void
-        */
-       public function buildQueryParametersPostProcess(&$parameters, $table, $pageId, $additionalConstraints, $fieldList, AbstractDatabaseRecordList $parentObj)
-       {
-               if (in_array($table, array_keys($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['static_info_tables']['tables']))) {
-                       $lang = substr(strtolower($this->getLanguageService()->lang), 0, 2);
-                       if (ExtensionManagementUtility::isLoaded('static_info_tables_' . $lang)) {
-                               $orderBy = str_replace('##', $lang, $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['static_info_tables']['tables'][$table]['label_fields'][0]);
-                               $parameters['orderBy'] = QueryHelper::parseOrderBy((string)$orderBy);
-                       }
-               }
-       }
+    /**
+     * Specify records order
+     *
+     * @param array $parameters
+     * @param string $table
+     * @param int $pageId
+     * @param string $additionalConstraints
+     * @param string $fieldList
+     * @param AbstractDatabaseRecordList $parentObj
+     *
+     * @return void
+     */
+    public function buildQueryParametersPostProcess(&$parameters, $table, $pageId, $additionalConstraints, $fieldList, AbstractDatabaseRecordList $parentObj)
+    {
+        if (in_array($table, array_keys($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['static_info_tables']['tables']))) {
+            $lang = substr(strtolower($this->getLanguageService()->lang), 0, 2);
+            if (ExtensionManagementUtility::isLoaded('static_info_tables_' . $lang)) {
+                $orderBy = str_replace('##', $lang, $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['static_info_tables']['tables'][$table]['label_fields'][0]);
+                $parameters['orderBy'] = QueryHelper::parseOrderBy((string)$orderBy);
+            }
+        }
+    }
 
-       protected function getLanguageService()
-       {
-               return $GLOBALS['LANG'];
-       }
-}
\ No newline at end of file
+    protected function getLanguageService()
+    {
+        return $GLOBALS['LANG'];
+    }
+}
index 4b5e364..92e4935 100644 (file)
@@ -26,41 +26,41 @@ namespace SJBR\StaticInfoTables\Hook\Backend\Recordlist;
 use TYPO3\CMS\Core\Database\Query\QueryBuilder;
 use TYPO3\CMS\Core\Database\Query\QueryHelper;
 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
-use TYPO3\CMS\Core\Utility\GeneralUtility;
 
 /**
  * Order records according to language field of current language
  */
 class ModifyQuery
 {
-       /**
-        * Specify records order
-        *
-        * @param array $parameters
-        * @param string $table
-        * @param int $pageId
-        * @param string $additionalConstraints
-        * @param string $fieldList
-        * @param QueryBuilder $queryBuilder
-        * @return void
-        */
-       public function modifyQuery(&$parameters, $table, $pageId, $additionalConstraints, $fieldList, QueryBuilder $queryBuilder)
-       {
-               if (in_array($table, array_keys($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['static_info_tables']['tables']))) {
-                       $lang = substr(strtolower($this->getLanguageService()->lang), 0, 2);
-                       if (ExtensionManagementUtility::isLoaded('static_info_tables_' . $lang)) {
-                               $orderBy = str_replace('##', $lang, $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['static_info_tables']['tables'][$table]['label_fields'][0]);
-                               $orderByFields = QueryHelper::parseOrderBy((string)$orderBy);
-                               foreach ($orderByFields as $fieldNameAndSorting) {
-                                       list($fieldName, $sorting) = $fieldNameAndSorting;
-                                       $queryBuilder->addOrderBy($fieldName, $sorting);
-                               }
-                       }
-               }
-       }
+    /**
+     * Specify records order
+     *
+     * @param array $parameters
+     * @param string $table
+     * @param int $pageId
+     * @param string $additionalConstraints
+     * @param string $fieldList
+     * @param QueryBuilder $queryBuilder
+     *
+     * @return void
+     */
+    public function modifyQuery(&$parameters, $table, $pageId, $additionalConstraints, $fieldList, QueryBuilder $queryBuilder)
+    {
+        if (in_array($table, array_keys($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['static_info_tables']['tables']))) {
+            $lang = substr(strtolower($this->getLanguageService()->lang), 0, 2);
+            if (ExtensionManagementUtility::isLoaded('static_info_tables_' . $lang)) {</