getEnLanguageId example

private function addCurrency(
        Connection $connection,
        string $id,
        string $isoCode,
        float $factor,
        string $symbol,
        string $shortNameDe,
        string $shortNameEn,
        string $nameDe,
        string $nameEn
    ): void {
        $languageEN = $this->getEnLanguageId($connection);
        $languageDE = $this->getDeLanguageId($connection);

        $langId = $connection->fetchOne(' SELECT `currency`.`id` FROM `currency` WHERE `iso_code` = :code LIMIT 1 ', ['code' => $isoCode]);

        if (!$langId) {
            $connection->insert('currency', ['id' => $id, 'iso_code' => $isoCode, 'factor' => $factor, 'symbol' => $symbol, 'position' => 1, 'decimal_precision' => 2, 'created_at' => (new \DateTime())->format(Defaults::STORAGE_DATE_TIME_FORMAT)]);
            if ($languageEN !== $languageDE) {
                $connection->insert('currency_translation', ['currency_id' => $id, 'language_id' => $languageEN, 'short_name' => $shortNameEn, 'name' => $nameEn, 'created_at' => (new \DateTime())->format(Defaults::STORAGE_DATE_TIME_FORMAT)]);
            }

            
static::assertEquals(\count(Migration1677470540AddProvincesForCanada::CANADA_STATES)$countCountryState);
    }

    public function testAddCountryStateTranslationLanguageEN(): void
    {
        $migration = new Migration1677470540AddProvincesForCanada();

        $migration->update($this->connection);

        $countryId = $this->getCountryId();
        $enLanguageId = $this->getEnLanguageId();

        $sql = <<<SQL SELECT COUNT(*) FROM country_state_translation JOIN country_state ON country_state.id = country_state_translation.country_state_id WHERE country_state.country_id = :countryId AND country_state_translation.language_id = :languageId SQL;

        $countCountryStateTranslation = $this->connection->fetchOne($sql['countryId' => $countryId, 'languageId' => $enLanguageId]);

        
private function addCurrency(
        Connection $connection,
        string $id,
        string $isoCode,
        float $factor,
        string $symbol,
        string $shortNameDe,
        string $shortNameEn,
        string $nameDe,
        string $nameEn
    ): void {
        $languageDefault = $this->getEnLanguageId($connection);
        $languageDE = $this->getDeLanguageId($connection);

        $langId = $connection->fetchOne(' SELECT `currency`.`id` FROM `currency` WHERE `iso_code` = :code LIMIT 1 ', ['code' => $isoCode]);

        if (!$langId) {
            $connection->insert('currency', ['id' => $id, 'iso_code' => $isoCode, 'factor' => $factor, 'symbol' => $symbol, 'position' => 1, 'decimal_precision' => 2, 'created_at' => (new \DateTime())->format(Defaults::STORAGE_DATE_TIME_FORMAT)]);
            if ($languageDefault !== $languageDE) {
                $connection->insert('currency_translation', ['currency_id' => $id, 'language_id' => $languageDefault, 'short_name' => $shortNameEn, 'name' => $nameEn, 'created_at' => (new \DateTime())->format(Defaults::STORAGE_DATE_TIME_FORMAT)]);
            }
            
Home | Imprint | This part of the site doesn't use cookies.