The current TermIdsResolver can only be used to resolve the terms of a single entity, otherwise you don’t know which terms in the return value belong to which entity. We want to introduce some other service with input and output like the following:
[ 'Q123' => [ 0, 1, 2 ], 'Q456' => [ 7, 8 ] ] ⇒ [ 'Q123' => [ 'label' => [ 'en' => [ 'some label' ] ], 'alias' => [ 'en' => [ 'some alias' ], 'de' => [ 'noch ein Alias' ] ], ], 'Q456' => [ 'label' => [ 'en' => [ 'a label' ], 'de' => [ 'eine Beschriftung' ] ], ], ]
It doesn’t need to know what the keys mean, it just preserves the association between the keys and the terms / term IDs – while ideally still retrieving all the terms, for all the keys, in bulk. (Though a simple implementation can of course iterate over the top-level array and call TermIdsResolver::resolveTermIds separately each time.)
Could be part of TermIdsResolver (either as an additional method or even replacing the current resolveTermIds) or a separate interface; in either case, though, the database implementation should be in DatabaseTermIdsResolver, not some other class.
Patch-For-Review (added to TermIdsResolver interface):