Wikibase
MediaWiki Wikibase extension
Wikibase\Lib\Changes\EntityChange Class Reference

Represents a change for an entity; to be extended by various change subtypes. More...

+ Inheritance diagram for Wikibase\Lib\Changes\EntityChange:
+ Collaboration diagram for Wikibase\Lib\Changes\EntityChange:

Public Member Functions

 getType ()
 
 getEntityId ()
 
 setEntityId (EntityId $entityId)
 Set the Change's entity id (as returned by getEntityId) and the object_id field. More...
 
 getAction ()
 
 getMetadata ( $cache='no')
 
 setMetadata (array $metadata)
 Sets metadata fields. More...
 
 getComment ()
 
 addUserMetadata (int $repoUserId, string $repoUserText, int $centralUserId)
 Add fields and metadata related to the user. More...
 
 setTimestamp ( $timestamp)
 
 getSerializedInfo ( $skipKeys=[])
 
- Public Member Functions inherited from Wikibase\Lib\Changes\DiffChange
 getCompactDiff ()
 
 setCompactDiff (EntityDiffChangedAspects $diff)
 
- Public Member Functions inherited from Wikibase\Lib\Changes\ChangeRow
 __construct (array $fields=[])
 
 setLogger (LoggerInterface $logger)
 
 getAge ()
 
 getTime ()
 
 getUserId ()
 Original (repository) user id, or 0 for logged out users. More...
 
 getObjectId ()
 
 getField ( $name)
 
 getFields ()
 Overwritten to unserialize the info field on the fly. More...
 
 getInfo ( $cache='no')
 Returns the info array. More...
 
 setField ( $name, $value)
 Sets the value of a field. More...
 
 setFields (array $fields)
 Sets multiple fields. More...
 
 getId ()
 
 hasField ( $name)
 Gets if a certain field is set. More...
 

Public Attributes

const UPDATE = 'update'
 
const ADD = 'add'
 
const REMOVE = 'remove'
 
const RESTORE = 'restore'
 
- Public Attributes inherited from Wikibase\Lib\Changes\ChangeRow
const ID = 'id'
 
const METADATA = 'metadata'
 
const INFO = 'info'
 
const TIME = 'time'
 
const USER_ID = 'user_id'
 
const OBJECT_ID = 'object_id'
 
const COMPACT_DIFF = 'compactDiff'
 
const TYPE = 'type'
 
const REVISION_ID = 'revision_id'
 

Protected Member Functions

 unserializeInfo ( $serialization)
 

Private Attributes

 $entityId = null
 

Additional Inherited Members

- Protected Attributes inherited from Wikibase\Lib\Changes\ChangeRow
 $logger
 

Detailed Description

Represents a change for an entity; to be extended by various change subtypes.

Author
Jeroen De Dauw < jeroe.nosp@m.nded.nosp@m.auw@g.nosp@m.mail.nosp@m..com >
Katie Filbert < aude..nosp@m.wiki.nosp@m.@gmai.nosp@m.l.co.nosp@m.m >
Daniel Kinzler
Matthew Flaschen < mflas.nosp@m.chen.nosp@m.@wiki.nosp@m.medi.nosp@m.a.org >

Member Function Documentation

◆ addUserMetadata()

Wikibase\Lib\Changes\EntityChange::addUserMetadata ( int  $repoUserId,
string  $repoUserText,
int  $centralUserId 
)

Add fields and metadata related to the user.

This does not touch other fields or metadata.

Parameters
int$repoUserIdUser ID on wiki where change was made, or 0 for anon
string$repoUserTextUser text on wiki where change was made, for either logged in user or anon
int$centralUserIdCentral user ID, or 0 if unknown or not applicable (see docs/change-propagation.wiki)

◆ getAction()

Wikibase\Lib\Changes\EntityChange::getAction ( )
Returns
string

◆ getComment()

Wikibase\Lib\Changes\EntityChange::getComment ( )
Returns
string

◆ getEntityId()

Wikibase\Lib\Changes\EntityChange::getEntityId ( )
Returns
EntityId

◆ getMetadata()

Wikibase\Lib\Changes\EntityChange::getMetadata (   $cache = 'no')
Parameters
string$cacheset to 'cache' to cache the unserialized diff.
Returns
array false if no meta data could be found in the info array

◆ getSerializedInfo()

Wikibase\Lib\Changes\EntityChange::getSerializedInfo (   $skipKeys = [])
See also
ChangeRow::getSerializedInfo
Parameters
string[]$skipKeys
Returns
string JSON

Reimplemented from Wikibase\Lib\Changes\ChangeRow.

◆ getType()

Wikibase\Lib\Changes\EntityChange::getType ( )
Returns
string

Implements Wikibase\Lib\Changes\Change.

◆ setEntityId()

Wikibase\Lib\Changes\EntityChange::setEntityId ( EntityId  $entityId)

Set the Change's entity id (as returned by getEntityId) and the object_id field.

Parameters
EntityId$entityId

◆ setMetadata()

Wikibase\Lib\Changes\EntityChange::setMetadata ( array  $metadata)

Sets metadata fields.

Unknown fields are ignored. New metadata is merged into the current metadata array.

Parameters
array$metadata

◆ setTimestamp()

Wikibase\Lib\Changes\EntityChange::setTimestamp (   $timestamp)
Parameters
string$timestampTimestamp in TS_MW format

◆ unserializeInfo()

Wikibase\Lib\Changes\EntityChange::unserializeInfo (   $serialization)
protected
See also
ChangeRow::unserializeInfo

Overwritten to use the array representation of the diff.

Parameters
string$serialization
Returns
array the info array

Reimplemented from Wikibase\Lib\Changes\ChangeRow.

Member Data Documentation

◆ $entityId

Wikibase\Lib\Changes\EntityChange::$entityId = null
private

◆ ADD

const Wikibase\Lib\Changes\EntityChange::ADD = 'add'

◆ REMOVE

const Wikibase\Lib\Changes\EntityChange::REMOVE = 'remove'

◆ RESTORE

const Wikibase\Lib\Changes\EntityChange::RESTORE = 'restore'

◆ UPDATE

const Wikibase\Lib\Changes\EntityChange::UPDATE = 'update'

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