Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Repo\Api\StatementModificationHelper Class Reference

Helper class for modifying an entities statements. More...

Public Member Functions

 __construct (SnakFactory $snakFactory, EntityIdParser $entityIdParser, StatementGuidValidator $guidValidator, ApiErrorReporter $errorReporter)
 
 validateStatementGuid ( $guid)
 
 getStatementFromEntity ( $guid, EntityDocument $entity)
 
 getSnakInstance (array $params, PropertyId $propertyId)
 
 createSummary (array $params, ApiBase $module)
 Creates a new Summary instance suitable for representing the action performed by this module.
 
 applyChangeOp (ChangeOp $changeOp, EntityDocument $entity, Summary $summary=null)
 Applies the given ChangeOp to the given Entity.
 

Private Attributes

 $snakFactory
 
 $entityIdParser
 
 $guidValidator
 
 $errorReporter
 

Detailed Description

Helper class for modifying an entities statements.

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\Api\StatementModificationHelper::__construct ( SnakFactory $snakFactory,
EntityIdParser $entityIdParser,
StatementGuidValidator $guidValidator,
ApiErrorReporter $errorReporter )

Member Function Documentation

◆ applyChangeOp()

Wikibase\Repo\Api\StatementModificationHelper::applyChangeOp ( ChangeOp $changeOp,
EntityDocument $entity,
Summary $summary = null )

Applies the given ChangeOp to the given Entity.

Any ChangeOpException is converted into an ApiUsageException with the code 'modification-failed'.

Parameters
ChangeOp$changeOp
EntityDocument$entity
Summary | null$summaryThe summary object to update with information about the change.

◆ createSummary()

Wikibase\Repo\Api\StatementModificationHelper::createSummary ( array $params,
ApiBase $module )

Creates a new Summary instance suitable for representing the action performed by this module.

Parameters
array$params
ApiBase$module
Returns
Summary

◆ getSnakInstance()

Wikibase\Repo\Api\StatementModificationHelper::getSnakInstance ( array $params,
PropertyId $propertyId )
Parameters
string[]$paramsArray with a 'snaktype' and an optional 'value' element.
PropertyId$propertyId
Exceptions
ApiUsageException
LogicException
Returns
Snak

◆ getStatementFromEntity()

Wikibase\Repo\Api\StatementModificationHelper::getStatementFromEntity ( $guid,
EntityDocument $entity )
Parameters
string$guid
EntityDocument$entity
Exceptions
ApiUsageException
Returns
Statement

◆ validateStatementGuid()

Wikibase\Repo\Api\StatementModificationHelper::validateStatementGuid ( $guid)
Parameters
string$guid
Returns
bool

Member Data Documentation

◆ $entityIdParser

Wikibase\Repo\Api\StatementModificationHelper::$entityIdParser
private

◆ $errorReporter

Wikibase\Repo\Api\StatementModificationHelper::$errorReporter
private

◆ $guidValidator

Wikibase\Repo\Api\StatementModificationHelper::$guidValidator
private

◆ $snakFactory

Wikibase\Repo\Api\StatementModificationHelper::$snakFactory
private

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