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

An EntityStore that does dispatching based on the entity type. More...

+ Inheritance diagram for Wikibase\Lib\Store\TypeDispatchingEntityStore:
+ Collaboration diagram for Wikibase\Lib\Store\TypeDispatchingEntityStore:

Public Member Functions

 __construct (array $callbacks, EntityStore $defaultStore, EntityRevisionLookup $lookup)
 
 assignFreshId (EntityDocument $entity)
 
 saveEntity (EntityDocument $entity, $summary, User $user, $flags=0, $baseRevId=false, array $tags=[])
 
 saveRedirect (EntityRedirect $redirect, $summary, User $user, $flags=0, $baseRevId=false)
 
 deleteEntity (EntityId $entityId, $reason, User $user)
 
 userWasLastToEdit (User $user, EntityId $id, $lastRevId)
 
 updateWatchlist (User $user, EntityId $id, $watch)
 
 isWatching (User $user, EntityId $id)
 
 canCreateWithCustomId (EntityId $id)
 
 getWikiPageForEntity (EntityId $entityId)
 

Private Member Functions

 getStore ( $entityType)
 

Private Attributes

 $stores
 
 $defaultStore
 
 $lookup
 

Detailed Description

An EntityStore that does dispatching based on the entity type.

Author
Thiemo Kreuz

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Lib\Store\TypeDispatchingEntityStore::__construct ( array  $callbacks,
EntityStore  $defaultStore,
EntityRevisionLookup  $lookup 
)
Parameters
callable[]$callbacksindexed by entity type
EntityStore$defaultStore
EntityRevisionLookup$lookup

Member Function Documentation

◆ assignFreshId()

Wikibase\Lib\Store\TypeDispatchingEntityStore::assignFreshId ( EntityDocument  $entity)
See also
EntityStore::assignFreshId
Parameters
EntityDocument$entity
Exceptions
StorageException

Implements Wikibase\Lib\Store\EntityStore.

◆ canCreateWithCustomId()

Wikibase\Lib\Store\TypeDispatchingEntityStore::canCreateWithCustomId ( EntityId  $id)
See also
EntityStore::canCreateWithCustomId
Parameters
EntityId$id
Returns
bool

Implements Wikibase\Lib\Store\EntityStore.

◆ deleteEntity()

Wikibase\Lib\Store\TypeDispatchingEntityStore::deleteEntity ( EntityId  $entityId,
  $reason,
User  $user 
)
See also
EntityStore::deleteEntity
Parameters
EntityId$entityId
string$reason
User$user

Implements Wikibase\Lib\Store\EntityStore.

◆ getStore()

Wikibase\Lib\Store\TypeDispatchingEntityStore::getStore (   $entityType)
private
Parameters
string$entityType
Exceptions
InvalidArgumentException
Returns
EntityStore

◆ getWikiPageForEntity()

Wikibase\Lib\Store\TypeDispatchingEntityStore::getWikiPageForEntity ( EntityId  $entityId)

◆ isWatching()

Wikibase\Lib\Store\TypeDispatchingEntityStore::isWatching ( User  $user,
EntityId  $id 
)
See also
EntityStore::isWatching
Parameters
User$user
EntityId$id
Returns
bool

Implements Wikibase\Lib\Store\EntityStore.

◆ saveEntity()

Wikibase\Lib\Store\TypeDispatchingEntityStore::saveEntity ( EntityDocument  $entity,
  $summary,
User  $user,
  $flags = 0,
  $baseRevId = false,
array  $tags = [] 
)
See also
EntityStore::saveEntity
Parameters
EntityDocument$entity
string$summary
User$user
int$flags
int | bool$baseRevId
string[]$tags
Exceptions
StorageException
PermissionsError
Returns
EntityRevision

Implements Wikibase\Lib\Store\EntityStore.

◆ saveRedirect()

Wikibase\Lib\Store\TypeDispatchingEntityStore::saveRedirect ( EntityRedirect  $redirect,
  $summary,
User  $user,
  $flags = 0,
  $baseRevId = false 
)
See also
EntityStore::saveRedirect
Parameters
EntityRedirect$redirect
string$summary
User$user
int$flags
int | bool$baseRevId
Exceptions
StorageException
PermissionsError
Returns
int The new revision ID

Implements Wikibase\Lib\Store\EntityStore.

◆ updateWatchlist()

Wikibase\Lib\Store\TypeDispatchingEntityStore::updateWatchlist ( User  $user,
EntityId  $id,
  $watch 
)
See also
EntityStore::updateWatchlist
Parameters
User$user
EntityId$id
bool$watch
Exceptions
MWException

Implements Wikibase\Lib\Store\EntityStore.

◆ userWasLastToEdit()

Wikibase\Lib\Store\TypeDispatchingEntityStore::userWasLastToEdit ( User  $user,
EntityId  $id,
  $lastRevId 
)
See also
EntityStore::userWasLastToEdit
Parameters
User$user
EntityId$id
int$lastRevId
Returns
bool

Implements Wikibase\Lib\Store\EntityStore.

Member Data Documentation

◆ $defaultStore

Wikibase\Lib\Store\TypeDispatchingEntityStore::$defaultStore
private

◆ $lookup

Wikibase\Lib\Store\TypeDispatchingEntityStore::$lookup
private

◆ $stores

Wikibase\Lib\Store\TypeDispatchingEntityStore::$stores
private

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