Wikibase
MediaWiki Wikibase extension
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. More...
 
 getEntityId ()
 Returns the ID of the entity held by this EntityHolder. More...
 
 getEntityType ()
 Returns the type of the entity held by this EntityHolder. More...
 

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\EntityInstanceHolder, Wikibase\Repo\Content\DeferredDecodingEntityHolder, and Wikibase\Repo\Content\DeferredCopyEntityHolder.

◆ 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\EntityInstanceHolder, Wikibase\Repo\Content\DeferredDecodingEntityHolder, and Wikibase\Repo\Content\DeferredCopyEntityHolder.

◆ 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\EntityInstanceHolder, Wikibase\Repo\Content\DeferredDecodingEntityHolder, and Wikibase\Repo\Content\DeferredCopyEntityHolder.


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