Wikibase
MediaWiki Wikibase extension
Wikibase\DataAccess\ByTypeDispatchingEntityIdLookup Class Reference

An EntityIdLookup that dispatches by Title content model to inner EntityIdLookups. More...

+ Inheritance diagram for Wikibase\DataAccess\ByTypeDispatchingEntityIdLookup:
+ Collaboration diagram for Wikibase\DataAccess\ByTypeDispatchingEntityIdLookup:

Public Member Functions

 __construct (array $entityContentModels, array $lookups, EntityIdLookup $defaultLookup)
 
 getEntityIds (array $titles)
 Returns the list of EntityIds of the entities associated with the given page titles. More...
 
 getEntityIdForTitle (Title $title)
 Returns the ID of the entity stored on the page identified by $title. More...
 

Private Member Functions

 getContentModelForTitle (Title $title)
 
 getLookupForContentModel (string $contentModel)
 

Private Attributes

 $entityContentModels
 
 $serviceDispatcher
 

Detailed Description

An EntityIdLookup that dispatches by Title content model to inner EntityIdLookups.

If no lookup is registered for the content model, then the lookup will fall back to a default lookup.

Constructor & Destructor Documentation

◆ __construct()

Wikibase\DataAccess\ByTypeDispatchingEntityIdLookup::__construct ( array  $entityContentModels,
array  $lookups,
EntityIdLookup  $defaultLookup 
)

Member Function Documentation

◆ getContentModelForTitle()

Wikibase\DataAccess\ByTypeDispatchingEntityIdLookup::getContentModelForTitle ( Title  $title)
private

◆ getEntityIdForTitle()

Wikibase\DataAccess\ByTypeDispatchingEntityIdLookup::getEntityIdForTitle ( Title  $title)

Returns the ID of the entity stored on the page identified by $title.

Note
There is no guarantee that the EntityId returned by this method refers to an existing entity.
Parameters
Title$title
Todo:
Switch this to using TitleValue once we can easily get the content model and handler based on a TitleValue.
Returns
EntityId|null

Implements Wikibase\Lib\Store\EntityIdLookup.

◆ getEntityIds()

Wikibase\DataAccess\ByTypeDispatchingEntityIdLookup::getEntityIds ( array  $titles)

Returns the list of EntityIds of the entities associated with the given page titles.

The resulting array uses the page IDs as keys.

Implementations may omit non-existing entities from the result. If they are included, they should have negative array keys.

Parameters
Title[]$titles
Exceptions
StorageException
Returns
EntityId[] Entity IDs, keyed by page IDs.

Implements Wikibase\Lib\Store\EntityIdLookup.

◆ getLookupForContentModel()

Wikibase\DataAccess\ByTypeDispatchingEntityIdLookup::getLookupForContentModel ( string  $contentModel)
private

Member Data Documentation

◆ $entityContentModels

Wikibase\DataAccess\ByTypeDispatchingEntityIdLookup::$entityContentModels
private

◆ $serviceDispatcher

Wikibase\DataAccess\ByTypeDispatchingEntityIdLookup::$serviceDispatcher
private

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