Skip to content
Snippets Groups Projects
Commit 3e08e53a authored by Torsten Oppermann's avatar Torsten Oppermann
Browse files

[BUGFIX] Fixing an exception in the be module

parent e652e07e
No related branches found
No related tags found
1 merge request!3New version 4 1
......@@ -39,7 +39,6 @@ use TYPO3\CMS\Extbase\Mvc\Request;
use TYPO3\CMS\Extbase\Object\ObjectManager;
use TYPO3\CMS\Extbase\Persistence\QueryResultInterface;
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
use TYPO3\CMS\Lang\Domain\Repository\LanguageRepository;
/**
* Backend Service class
......@@ -137,6 +136,34 @@ class BackendService {
return $siteRoot['uid'];
}
/**
* Get the selected templates for the selected language
*
* @param string $selectedExtension
* @param string $selectedTemplate
* @param array $languages
* @param int $pid
* @return array
* @throws \InvalidArgumentException
*/
public static function getSelectedTemplates(
$selectedExtension, $selectedTemplate, array $languages, $pid
) {
$selectedTemplates = [];
$objectManager = GeneralUtility::makeInstance(ObjectManager::class);
/** @var TemplateRepository $templateRepository */
$templateRepository = $objectManager->get(TemplateRepository::class);
foreach ($languages as $language) {
$selectedTemplates[$language['isocode']] = $templateRepository->findOneByTemplate(
$selectedExtension, $selectedTemplate, $language['isocode'], $pid
);
}
return $selectedTemplates;
}
/**
* get an array of all the locales for the activated languages
*
......@@ -196,8 +223,10 @@ class BackendService {
array_unshift($languages, '');
$filterLanguages = [];
foreach ($languages as $key => $value) {
$filterLanguages[$value] = $value;
if (count($filterLanguages) < 0) {
foreach ($languages as $key => $value) {
$filterLanguages[$value] = $value;
}
}
return $filterLanguages;
......
......@@ -72,7 +72,7 @@ class UpdateLanguages extends AbstractUpdate {
$description = 'Check all the language codes in the database';
/** @var DatabaseConnection $databaseConnection */
$databaseConnection = $GLOBALS['TYPO3_DB'];
$databaseConnection = $this->getDatabaseConnection();
foreach ($this->tables as $table) {
/** @var \mysqli_result $result */
......@@ -94,7 +94,8 @@ class UpdateLanguages extends AbstractUpdate {
* @return bool Whether everything went smoothly or not
*/
public function performUpdate(array &$dbQueries, &$customMessages) {
$databaseConnection = $GLOBALS['TYPO3_DB'];
/** @var DatabaseConnection $databaseConnection */
$databaseConnection = $this->getDatabaseConnection();
foreach ($this->tables as $table) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment