Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Lib\Changes\EntityChangeFactory Class Reference

Factory for EntityChange objects. More...

Public Member Functions

 __construct (EntityDiffer $entityDiffer, EntityIdParser $idParser, array $changeClasses)
 
 newForChangeType ( $changeType, EntityId $entityId, array $fields)
 
 newFromFieldData (array $fields)
 
 newFromUpdate ( $action, EntityDocument $oldEntity=null, EntityDocument $newEntity=null)
 Constructs an EntityChange from the given old and new Entity.
 

Private Attributes

 $entityDiffer
 
 $idParser
 
 $changeClasses
 

Detailed Description

Factory for EntityChange objects.

Author
Daniel Kinzler
Bene* < benes.nosp@m.tar..nosp@m.wikim.nosp@m.edia.nosp@m.@gmai.nosp@m.l.co.nosp@m.m >

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Lib\Changes\EntityChangeFactory::__construct ( EntityDiffer  $entityDiffer,
EntityIdParser  $idParser,
array  $changeClasses 
)
Parameters
EntityDiffer$entityDiffer
EntityIdParser$idParser
string[]$changeClassesMaps entity type IDs to subclasses of EntityChange. Entity types not mapped explicitly are assumed to use EntityChange itself.

Member Function Documentation

◆ newForChangeType()

Wikibase\Lib\Changes\EntityChangeFactory::newForChangeType (   $changeType,
EntityId  $entityId,
array  $fields 
)
Parameters
string$changeType
EntityId$entityId
array$fieldsadditional fields to set
Exceptions
InvalidArgumentException
Returns
EntityChange

◆ newFromFieldData()

Wikibase\Lib\Changes\EntityChangeFactory::newFromFieldData ( array  $fields)
Parameters
array$fieldsall data fields, including at least 'type' and 'object_id'.
Exceptions
InvalidArgumentException
Returns
EntityChange

◆ newFromUpdate()

Wikibase\Lib\Changes\EntityChangeFactory::newFromUpdate (   $action,
EntityDocument  $oldEntity = null,
EntityDocument  $newEntity = null 
)

Constructs an EntityChange from the given old and new Entity.

Parameters
string$actionThe action name
EntityDocument | null$oldEntity
EntityDocument | null$newEntity
Returns
EntityChange
Exceptions
MWException

Member Data Documentation

◆ $changeClasses

Wikibase\Lib\Changes\EntityChangeFactory::$changeClasses
private

◆ $entityDiffer

Wikibase\Lib\Changes\EntityChangeFactory::$entityDiffer
private

◆ $idParser

Wikibase\Lib\Changes\EntityChangeFactory::$idParser
private

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