Wikibase
MediaWiki Wikibase extension
Wikibase\Repo\ChangeOp\ChangeOp Interface Reference

A ChangeOp represents a modification of an entity. More...

+ Inheritance diagram for Wikibase\Repo\ChangeOp\ChangeOp:

Public Member Functions

 getActions ()
 Returns a list of actions, defined as EntityPermissionChecker::ACTION_ constants, that the change op involves, so user permissions can be checked accordingly prior to validating and/or applying the change op. More...
 
 validate (EntityDocument $entity)
 Validates the current ChangeOp. More...
 
 apply (EntityDocument $entity, Summary $summary=null)
 Applies the change represented by this ChangeOp to the given Entity. More...
 

Detailed Description

A ChangeOp represents a modification of an entity.

It is responsible for the actual modifications, as well as providing associated services such as building an appropriate edit summary and performing validation of the change.

Author
Addshore
Daniel Kinzler

Member Function Documentation

◆ apply()

Wikibase\Repo\ChangeOp\ChangeOp::apply ( EntityDocument  $entity,
Summary  $summary = null 
)

Applies the change represented by this ChangeOp to the given Entity.

As ChangeOp does not yet know whether it is going to change the entity or not, and since expensive validations should be run only on ChangeOps that will change the entity, ChangeOpResult::validate is recommended for such validations.

Parameters
EntityDocument$entity
Summary | null$summary
Exceptions
InvalidArgumentExceptionwhen called with an unexpected entity type.
ChangeOpExceptionwhen the change can not be applied to the entity, e.g. because the same data was edited in the meantime.
Returns
ChangeOpResult

Implemented in Wikibase\Repo\ChangeOp\NullChangeOp, Wikibase\Repo\ChangeOp\ChangeOpStatementRank, Wikibase\Repo\ChangeOp\ChangeOpStatement, Wikibase\Repo\ChangeOp\ChangeOpSiteLink, Wikibase\Repo\ChangeOp\ChangeOps, Wikibase\Repo\ChangeOp\ChangeOpRemoveStatement, Wikibase\Repo\ChangeOp\ChangeOpReferenceRemove, Wikibase\Repo\ChangeOp\ChangeOpReference, Wikibase\Repo\ChangeOp\ChangeOpQualifierRemove, Wikibase\Repo\ChangeOp\ChangeOpQualifier, Wikibase\Repo\ChangeOp\ChangeOpMainSnak, Wikibase\Repo\ChangeOp\ChangeOpLabel, Wikibase\Repo\ChangeOp\ChangeOpFingerprint, Wikibase\Repo\ChangeOp\ChangeOpDescription, and Wikibase\Repo\ChangeOp\ChangeOpAliases.

◆ getActions()

Wikibase\Repo\ChangeOp\ChangeOp::getActions ( )

Returns a list of actions, defined as EntityPermissionChecker::ACTION_ constants, that the change op involves, so user permissions can be checked accordingly prior to validating and/or applying the change op.

Returns
string[] Array of EntityPermissionChecker::ACTION_ constants

Implemented in Wikibase\Repo\ChangeOp\NullChangeOp, Wikibase\Repo\ChangeOp\ChangeOps, Wikibase\Repo\ChangeOp\ChangeOpLabel, Wikibase\Repo\ChangeOp\ChangeOpFingerprint, Wikibase\Repo\ChangeOp\ChangeOpDescription, Wikibase\Repo\ChangeOp\ChangeOpBase, and Wikibase\Repo\ChangeOp\ChangeOpAliases.

◆ validate()


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