Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
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.
 
 validate (EntityDocument $entity)
 Validates the current ChangeOp.
 
 apply (EntityDocument $entity, Summary $summary=null)
 Applies the change represented by this ChangeOp to the given Entity.
 

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\ChangeOpAliases, Wikibase\Repo\ChangeOp\ChangeOpDescription, Wikibase\Repo\ChangeOp\ChangeOpFingerprint, Wikibase\Repo\ChangeOp\ChangeOpLabel, Wikibase\Repo\ChangeOp\ChangeOpMainSnak, Wikibase\Repo\ChangeOp\ChangeOpQualifier, Wikibase\Repo\ChangeOp\ChangeOpQualifierRemove, Wikibase\Repo\ChangeOp\ChangeOpReference, Wikibase\Repo\ChangeOp\ChangeOpReferenceRemove, Wikibase\Repo\ChangeOp\ChangeOpRemoveSiteLink, Wikibase\Repo\ChangeOp\ChangeOpRemoveStatement, Wikibase\Repo\ChangeOp\ChangeOps, Wikibase\Repo\ChangeOp\ChangeOpSiteLink, Wikibase\Repo\ChangeOp\ChangeOpStatement, Wikibase\Repo\ChangeOp\ChangeOpStatementRank, and Wikibase\Repo\ChangeOp\NullChangeOp.

◆ 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\ChangeOpAliases, Wikibase\Repo\ChangeOp\ChangeOpBase, Wikibase\Repo\ChangeOp\ChangeOpDescription, Wikibase\Repo\ChangeOp\ChangeOpFingerprint, Wikibase\Repo\ChangeOp\ChangeOpLabel, Wikibase\Repo\ChangeOp\ChangeOps, and Wikibase\Repo\ChangeOp\NullChangeOp.

◆ validate()

Wikibase\Repo\ChangeOp\ChangeOp::validate ( EntityDocument $entity)

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