Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\DataAccess\ByTypeDispatchingEntityRevisionLookup Class Reference

An EntityRevisionLookup that dispatches by entity type to inner EntityRevisionLookups. More...

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

Public Member Functions

 __construct (array $lookups)
 
 getEntityRevision (EntityId $entityId, $revisionId=0, $mode=LookupConstants::LATEST_FROM_REPLICA)
 Returns the entity revision with the provided id or null if there is no such entity or if access is forbidden.
 
 getLatestRevisionId (EntityId $entityId, $mode=LookupConstants::LATEST_FROM_REPLICA)
 Returns the id of the latest revision of the given entity, or false if there is no such entity.
 

Private Member Functions

 getLookupForEntity (EntityId $entityId)
 

Private Attributes

 $lookups
 

Detailed Description

An EntityRevisionLookup that dispatches by entity type to inner EntityRevisionLookups.

If no lookup is registered for the entity type the lookup will fail in an unexceptional way.

TODO Wikibase\Lib\Store\TypeDispatchingEntityRevisionLookup is similar, but a bit different, also conceptually. The other class could maybe be renamed or so?

TODO this has been introduced into data-access with a couple of points that still bind to wikibase lib and other parts of mediawiki, these should be cleaned up:

  • Wikibase\Lib\Store\EntityRevisionLookup;
    • Wikibase\Lib\Store\RevisionedUnresolvedRedirectException
    • Wikibase\Lib\Store\StorageException
      • Status
  • Wikibase\Lib\Store\LatestRevisionIdResult;

Constructor & Destructor Documentation

◆ __construct()

Wikibase\DataAccess\ByTypeDispatchingEntityRevisionLookup::__construct ( array  $lookups)

Member Function Documentation

◆ getEntityRevision()

Wikibase\DataAccess\ByTypeDispatchingEntityRevisionLookup::getEntityRevision ( EntityId  $entityId,
  $revisionId = 0,
  $mode = LookupConstants::LATEST_FROM_REPLICA 
)

Returns the entity revision with the provided id or null if there is no such entity or if access is forbidden.

If a $revisionId is given, the requested revision of the entity is loaded. If that revision does not exist or does not belong to the given entity, an exception is thrown.

Implementations of this method must not silently resolve redirects.

Parameters
EntityId$entityId
int | null$revisionIdThe desired revision id, or 0 for the latest revision.
string$modeLookupConstants::LATEST_FROM_REPLICA, LookupConstants::LATEST_FROM_REPLICA_WITH_FALLBACK or LookupConstants::LATEST_FROM_MASTER.
Exceptions
RevisionedUnresolvedRedirectException
StorageException
Returns
EntityRevision|null

Implements Wikibase\Lib\Store\EntityRevisionLookup.

◆ getLatestRevisionId()

Wikibase\DataAccess\ByTypeDispatchingEntityRevisionLookup::getLatestRevisionId ( EntityId  $entityId,
  $mode = LookupConstants::LATEST_FROM_REPLICA 
)

Returns the id of the latest revision of the given entity, or false if there is no such entity.

Implementations of this method must not silently resolve redirects. They can however return a LatestRevisionIdResult object containing information about the redirect.

Parameters
EntityId$entityId
string$modeLookupConstants::LATEST_FROM_REPLICA, LookupConstants::LATEST_FROM_REPLICA_WITH_FALLBACK or LookupConstants::LATEST_FROM_MASTER. LATEST_FROM_MASTER would force the revision to be determined from the canonical master database.
Returns
LatestRevisionIdResult

Implements Wikibase\Lib\Store\EntityRevisionLookup.

◆ getLookupForEntity()

Wikibase\DataAccess\ByTypeDispatchingEntityRevisionLookup::getLookupForEntity ( EntityId  $entityId)
private

Member Data Documentation

◆ $lookups

Wikibase\DataAccess\ByTypeDispatchingEntityRevisionLookup::$lookups
private

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