Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Repo\Content\EntityHolder Interface Reference

A holder for entity objects. More...

+ Inheritance diagram for Wikibase\Repo\Content\EntityHolder:

Public Member Functions

 getEntity ( $expectedClass=EntityDocument::class)
 Returns the entity held by this EntityHolder.
 
 getEntityId ()
 Returns the ID of the entity held by this EntityHolder.
 
 getEntityType ()
 Returns the type of the entity held by this EntityHolder.
 

Detailed Description

A holder for entity objects.

Author
Daniel Kinzler

Member Function Documentation

◆ getEntity()

Wikibase\Repo\Content\EntityHolder::getEntity ( $expectedClass = EntityDocument::class)

Returns the entity held by this EntityHolder.

Depending on the implementation, this operation may be expensive or trivial.

Parameters
string$expectedClassThe class with which the result is expected to be compatible. Defaults to EntityDocument.
Exceptions
RuntimeExceptionIf the entity held by this EntityHolder is not compatible with $expectedClass.
Returns
EntityDocument

Implemented in Wikibase\Repo\Content\DeferredCopyEntityHolder, Wikibase\Repo\Content\DeferredDecodingEntityHolder, and Wikibase\Repo\Content\EntityInstanceHolder.

◆ getEntityId()

Wikibase\Repo\Content\EntityHolder::getEntityId ( )

Returns the ID of the entity held by this EntityHolder.

May or may not require the actual entity to be instantiated. May be null if the entity does not have an ID set.

Returns
EntityId|null

Implemented in Wikibase\Repo\Content\DeferredCopyEntityHolder, Wikibase\Repo\Content\DeferredDecodingEntityHolder, and Wikibase\Repo\Content\EntityInstanceHolder.

◆ getEntityType()

Wikibase\Repo\Content\EntityHolder::getEntityType ( )

Returns the type of the entity held by this EntityHolder.

May or may not require the actual entity or the entity's ID to be instantiated. Implementations must make sure that this is never null.

Returns
string

Implemented in Wikibase\Repo\Content\DeferredCopyEntityHolder, Wikibase\Repo\Content\DeferredDecodingEntityHolder, and Wikibase\Repo\Content\EntityInstanceHolder.


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