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

Public Member Functions

 __construct (EntityDiffer $entityDiffer, EntityIdParser $idParser, array $changeClasses, string $defaultEntityChange=EntityChange::class, ?LoggerInterface $logger=null)
 
 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
 
 $defaultEntityChange
 
 $logger
 

Detailed Description

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,
string $defaultEntityChange = EntityChange::class,
?LoggerInterface $logger = null )
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.
string$defaultEntityChange
LoggerInterface | null$logger

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
Exception

Member Data Documentation

◆ $changeClasses

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

◆ $defaultEntityChange

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

◆ $entityDiffer

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

◆ $idParser

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

◆ $logger

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

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