[UI][ENTITY][Language] Use list rather than hashmap so actor language ordering is preserved

This commit is contained in:
Hugo Sales 2021-11-26 12:30:21 +00:00
parent 04e6b2fb53
commit 283820a4a5
Signed by untrusted user: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0

View File

@ -379,19 +379,16 @@ class Actor extends Entity
{ {
$id = $context?->getId() ?? $this->getId(); $id = $context?->getId() ?? $this->getId();
$key = ActorLanguage::collectionCacheKey($this, $context); $key = ActorLanguage::collectionCacheKey($this, $context);
$langs = Cache::getHashMap( $langs = Cache::getList(
$key, $key,
fn () => F\reindex( fn () => DB::dql(
DB::dql( 'select l from actor_language al join language l with al.language_id = l.id where al.actor_id = :id order by al.ordering ASC',
'select l from actor_language al join language l with al.language_id = l.id where al.actor_id = :id order by al.ordering ASC', ['id' => $id],
['id' => $id],
),
fn (Language $l) => $l->getLocale(),
), ),
) ?: [ ) ?: [
Common::config('site', 'language') => Language::getFromLocale(Common::config('site', 'language')), Language::getFromLocale(Common::config('site', 'language')),
]; ];
return array_merge(...F\map(array_values($langs), fn ($l) => $l->toChoiceFormat())); return array_merge(...F\map($langs, fn ($l) => $l->toChoiceFormat()));
} }
public static function schemaDef(): array public static function schemaDef(): array