Project

General

Profile

Actions

Bug #88015

closed

Can't edit TCA records with language set to All languages(sys_language_uid = -1)

Added by Ricky Mathew over 5 years ago. Updated about 5 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Site Handling, Site Sets & Routing
Target version:
-
Start date:
2019-03-27
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
9
PHP Version:
Tags:
routing,TCA
Complexity:
easy
Is Regression:
Sprint Focus:

Description

I have lot of TCA records with language set to All languages (sys_language_uid = -1) . But i cant edit the TCA records since it throws the following error:


(1/1) #1522960188 InvalidArgumentException
Language -1 does not exist on site example.

in typo3/sysext/core/Classes/Site/Entity/Site.php line 237

        throw new \InvalidArgumentException(
            'Language ' . $languageId . ' does not exist on site ' . $this->identifier . '.',
            1522960188
        );
    }

The error throws obviously as -1 is not there in the corresponding site configuration.So i added a patch in typo3/sysext/core/Classes/Site/Entity/Site.php as follows and it works and not breaking anything else.

    public function getLanguageById(int $languageId): SiteLanguage
    {
        if (isset($this->languages[$languageId])) {
            return $this->languages[$languageId];
        }
        /**patch to fix editing of TCA records set with All languages(sys_language_uid = -1)**/
        elseif ($languageId == -1) {
            return $this->languages[0];
        }
        throw new \InvalidArgumentException(
            'Language ' . $languageId . ' does not exist on site ' . $this->identifier . '.',
            1522960188
        );
    }

If this solution feels sensible can anyone please push it to the gerrit review.

Actions

Also available in: Atom PDF