Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Repo\Content\DeferredCopyEntityHolder Class Reference

EntityHolder implementing deferred copying. More...

+ Inheritance diagram for Wikibase\Repo\Content\DeferredCopyEntityHolder:
+ Collaboration diagram for Wikibase\Repo\Content\DeferredCopyEntityHolder:

Public Member Functions

 __construct (EntityHolder $entityHolder)
 
 getEntity ( $expectedClass=EntityDocument::class)
 
 getEntityId ()
 
 getEntityType ()
 

Private Attributes

 $entityHolder
 
 $entity = null
 

Detailed Description

EntityHolder implementing deferred copying.

Author
Daniel Kinzler

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\Content\DeferredCopyEntityHolder::__construct ( EntityHolder $entityHolder)

Member Function Documentation

◆ getEntity()

Wikibase\Repo\Content\DeferredCopyEntityHolder::getEntity ( $expectedClass = EntityDocument::class)
See also
EntityHolder::getEntityId

This implements lazy initialization of the entity: when called for the first time, this method will call getEntity() on the EntityHolder passed to the constructor, and then deep clone the entity returned. The resulting copy is returned. Subsequent calls will return the same entity.

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

Implements Wikibase\Repo\Content\EntityHolder.

◆ getEntityId()

Wikibase\Repo\Content\DeferredCopyEntityHolder::getEntityId ( )
See also
EntityHolder::getEntityId
Returns
EntityId|null

Implements Wikibase\Repo\Content\EntityHolder.

◆ getEntityType()

Wikibase\Repo\Content\DeferredCopyEntityHolder::getEntityType ( )
See also
EntityHolder::getEntityType
Returns
string

Implements Wikibase\Repo\Content\EntityHolder.

Member Data Documentation

◆ $entity

Wikibase\Repo\Content\DeferredCopyEntityHolder::$entity = null
private

◆ $entityHolder

Wikibase\Repo\Content\DeferredCopyEntityHolder::$entityHolder
private

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