Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Lib\Store\Sql\Terms\StaticTypeIdsStore Class Reference

A type IDs acquirer and resolver that only encapsulates access to a static array of IDs. More...

+ Inheritance diagram for Wikibase\Lib\Store\Sql\Terms\StaticTypeIdsStore:
+ Collaboration diagram for Wikibase\Lib\Store\Sql\Terms\StaticTypeIdsStore:

Public Member Functions

 __construct (array $types)
 
 acquireTypeIds (array $types)
 Acquires ids of stored types, persisting the ones that do not exist yet.
 
 resolveTypeIds (array $typeIds)
 Resolves types for the given type IDs.
 
 lookupTypeIds (array $types)
 Lookup type ids for given type names.
 

Private Attributes

 $typeIdsByName
 
 $typeNamesById
 

Detailed Description

A type IDs acquirer and resolver that only encapsulates access to a static array of IDs.

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Lib\Store\Sql\Terms\StaticTypeIdsStore::__construct ( array $types)
Parameters
int[]$typesArray from type name to type ID.

Member Function Documentation

◆ acquireTypeIds()

Wikibase\Lib\Store\Sql\Terms\StaticTypeIdsStore::acquireTypeIds ( array $types)

Acquires ids of stored types, persisting the ones that do not exist yet.

Parameters
array$typeslist of types to acquire ids for
Returns
array keys in returned array are the types passed in $types associated with their acquired ids. Example: $typeIdsAcquirer->acquireTypeIds ( [ 'label', 'description' ] ) would return: [ 'label' => 100, 'description' => 121 ]

Implements Wikibase\Lib\Store\Sql\Terms\TypeIdsAcquirer.

◆ lookupTypeIds()

Wikibase\Lib\Store\Sql\Terms\StaticTypeIdsStore::lookupTypeIds ( array $types)

Lookup type ids for given type names.

Parameters
string[]$types
Returns
int[] array type names to type ids

Implements Wikibase\Lib\Store\Sql\Terms\TypeIdsLookup.

◆ resolveTypeIds()

Wikibase\Lib\Store\Sql\Terms\StaticTypeIdsStore::resolveTypeIds ( array $typeIds)

Resolves types for the given type IDs.

Parameters
int[]$typeIds
Returns
string[] Array from type IDs to type names. Unknown IDs in $typeIds are omitted.

Implements Wikibase\Lib\Store\Sql\Terms\TypeIdsResolver.

Member Data Documentation

◆ $typeIdsByName

Wikibase\Lib\Store\Sql\Terms\StaticTypeIdsStore::$typeIdsByName
private

◆ $typeNamesById

Wikibase\Lib\Store\Sql\Terms\StaticTypeIdsStore::$typeNamesById
private

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