Wikibase
MediaWiki Wikibase extension
|
A ChangeOp represents a modification of an entity. More...
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... | |
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.
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 ChangeOp
s that will change the entity, ChangeOpResult::validate is recommended for such validations.
EntityDocument | $entity | |
Summary | null | $summary |
InvalidArgumentException | when called with an unexpected entity type. |
ChangeOpException | when the change can not be applied to the entity, e.g. because the same data was edited in the meantime. |
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.
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.
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.
Wikibase\Repo\ChangeOp\ChangeOp::validate | ( | EntityDocument | $entity | ) |
Validates the current ChangeOp.
This indicates whether this ChangeOp is valid with respect to the given entity.
EntityDocument | $entity |
InvalidArgumentException | when called with an unexpected entity type. |
ChangeOpException | when the change is invalid for this entity for other reasons than the entity type. |
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.