Skip to content

Conversation

@caters-ed
Copy link

I have been using this package to seed languages into my database. In a previous version (2.0.0?), that doesn't seem to be available anymore, I could loop through all languages and use public int indexes to get the value that I wanted.

public int $indexIso639_1 = 0;
public int $indexIso639_2t = 1;
public int $indexIso639_2b = 2;
public int $indexIso639_3 = 3;
public int $indexEnglishName = 4;
public int $indexNativeName = 5;

Now private const indexes are being used and my integration has been broken and I am unable to do this.

By using public consts I will be able to update my code to use these instead. As they are consts it shouldn't matter that they are public as they cannot change anyway.

My integration can be updated from:

$iso639 = new ISO639;
$languages = $iso639->allLanguages();

foreach($languages as $language) {
    Language::create([
        'iso_639_1' => $language[$iso639->indexIso639_1],
        'iso_639_2' => $language[$iso639->indexIso639_2b],
        'name' => $language[$iso639->indexEnglishName],
    ]);
}

To:

$languages = new ISO639;
$languages = $iso639->allLanguages();

foreach($languages as $language) {
    Language::create([
        'iso_639_1' => $language[$iso639::INDEX_ISO639_1],
        'iso_639_2' => $language[$iso639::INDEX_ISO639_2B],
        'name' => $language[$iso639::INDEX_ENGLISH_NAME],
    ]);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant