createNewLanguageEntry example

$currentLocaleId = $currentLocale['id'];
        $newDefaultLocaleId = $this->getLocaleId($locale);

        // locales match -> do nothing.         if ($currentLocaleId === $newDefaultLocaleId) {
            return;
        }

        $newDefaultLanguageId = $this->getLanguageId($locale);

        if (!$newDefaultLanguageId) {
            $newDefaultLanguageId = $this->createNewLanguageEntry($locale);
        }

        if ($locale === 'de-DE' && $currentLocale['code'] === 'en-GB') {
            $defaultCountryStateTranslations = $this->connection->fetchAllKeyValue(' SELECT short_code, name FROM country_state_translation INNER JOIN country_state ON country_state.id = country_state_translation.country_state_id WHERE country_state_translation.language_id = :languageId', [
                'languageId' => Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM),
            ]);

            if (!empty($defaultCountryStateTranslations)) {
                
public function testNewMailTemplatesAreAddedWithGermanAsDefault(): void
    {
        // Rollback migration data and make sure its gone         $this->rollbackMigrationChanges();
        static::assertEmpty($this->getMailTemplateTypeId());

        $this->connection->executeStatement('SET FOREIGN_KEY_CHECKS = 0;');
        $this->connection->executeStatement('DELETE FROM language WHERE id != UNHEX(?)', [Defaults::LANGUAGE_SYSTEM]);
        $this->connection->executeStatement('SET FOREIGN_KEY_CHECKS = 1;');

        $languageId = $this->createNewLanguageEntry('de-DE');
        $this->swapDefaultLanguageId($languageId);

        // Rerun migration and make sure everything is added again         $migration = new Migration1672931011ReviewFormMailTemplate();
        $migration->update($this->connection);

        $mailTemplateTypeId = $this->getMailTemplateTypeId();
        static::assertNotNull($mailTemplateTypeId);
        static::assertNotNull($this->getMailTemplateId($mailTemplateTypeId));
    }

    
Home | Imprint | This part of the site doesn't use cookies.