Wikibase
MediaWiki Wikibase extension
Wikibase\Lib\Store\LanguageFallbackLabelDescriptionLookupFactory Class Reference

Factory to provide an LabelDescriptionLookup which does automatic prefetching of terms, applies a language fallback and returns the LabelDescriptionLookup. More...

Public Member Functions

 __construct (LanguageFallbackChainFactory $languageFallbackChainFactory, TermLookup $termLookup, TermBuffer $termBuffer=null, $fallbackMode=LanguageFallbackChainFactory::FALLBACK_ALL)
 
 newLabelDescriptionLookup (Language $language, array $entityIds=[], array $termTypes=[ 'label'])
 Returns a LabelDescriptionLookup where terms are prefetched for the given entity ids with a language fallback chain applied for the given language. More...
 

Private Attributes

 $languageFallbackChainFactory
 
 $termLookup
 
 $termBuffer
 
 $fallbackMode
 

Detailed Description

Factory to provide an LabelDescriptionLookup which does automatic prefetching of terms, applies a language fallback and returns the LabelDescriptionLookup.

Author
Bene* < benes.nosp@m.tar..nosp@m.wikim.nosp@m.edia.nosp@m.@gmai.nosp@m.l.co.nosp@m.m >

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Lib\Store\LanguageFallbackLabelDescriptionLookupFactory::__construct ( LanguageFallbackChainFactory  $languageFallbackChainFactory,
TermLookup  $termLookup,
TermBuffer  $termBuffer = null,
  $fallbackMode = LanguageFallbackChainFactory::FALLBACK_ALL 
)
Parameters
LanguageFallbackChainFactory$languageFallbackChainFactory
TermLookup$termLookup
TermBuffer | null$termBuffer
int$fallbackModeEither 0 or a combination of the LanguageFallbackChainFactory::FALLBACK_... constants.
Exceptions
InvalidArgumentException

Member Function Documentation

◆ newLabelDescriptionLookup()

Wikibase\Lib\Store\LanguageFallbackLabelDescriptionLookupFactory::newLabelDescriptionLookup ( Language  $language,
array  $entityIds = [],
array  $termTypes = [ 'label' ] 
)

Returns a LabelDescriptionLookup where terms are prefetched for the given entity ids with a language fallback chain applied for the given language.

Parameters
Language$language
EntityId[]$entityIdsArray of entity ids that should be prefetched. Only relevant when a TermBuffer was set in the constructor. Default is no prefetching.
string[]$termTypesArray with one or more of the types 'label', 'alias' and 'description'. Default is only 'label'.
Returns
LanguageFallbackLabelDescriptionLookup

Member Data Documentation

◆ $fallbackMode

Wikibase\Lib\Store\LanguageFallbackLabelDescriptionLookupFactory::$fallbackMode
private

◆ $languageFallbackChainFactory

Wikibase\Lib\Store\LanguageFallbackLabelDescriptionLookupFactory::$languageFallbackChainFactory
private

◆ $termBuffer

Wikibase\Lib\Store\LanguageFallbackLabelDescriptionLookupFactory::$termBuffer
private

◆ $termLookup

Wikibase\Lib\Store\LanguageFallbackLabelDescriptionLookupFactory::$termLookup
private

The documentation for this class was generated from the following file: