Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
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 ()
 Returns the type of change.
 
 getEntityId ()
 
 setEntityId (EntityId $entityId)
 Set the Change's entity id (as returned by getEntityId) and the object_id field.
 
 getAction ()
 
 getMetadata (string $cache='no')
 
 setMetadata (array $metadata)
 Sets metadata fields.
 
 getComment ()
 
 addUserMetadata (int $repoUserId, string $repoUserText, int $centralUserId)
 Add fields and metadata related to the user.
 
 setTimestamp (string $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.
 
 getObjectId ()
 
 getField ( $name)
 
 getFields ()
 Overwritten to unserialize the info field on the fly.
 
 getInfo ( $cache='no')
 Returns the info array.
 
 setField ( $name, $value)
 Sets the value of a field.
 
 setFields (array $fields)
 Sets multiple fields.
 
 getId ()
 
 hasField ( $name)
 Gets if a certain field is set.
 

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 $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 ( )

◆ getComment()

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

◆ getEntityId()

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

◆ getMetadata()

Wikibase\Lib\Changes\EntityChange::getMetadata ( string $cache = 'no')
Parameters
string$cacheset to 'cache' to cache the unserialized diff.
Returns
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 the type of change.

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.

◆ setMetadata()

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

Sets metadata fields.

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

◆ setTimestamp()

Wikibase\Lib\Changes\EntityChange::setTimestamp ( string $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

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: