Wikibase
MediaWiki Wikibase extension
Wikibase\Repo\Api\SetReference Class Reference

API module for creating a reference or setting the value of an existing one. More...

+ Inheritance diagram for Wikibase\Repo\Api\SetReference:
+ Collaboration diagram for Wikibase\Repo\Api\SetReference:

Public Member Functions

 __construct (ApiMain $mainModule, string $moduleName, DeserializerFactory $deserializerFactory, ApiErrorReporter $errorReporter, StatementChangeOpFactory $statementChangeOpFactory, StatementModificationHelper $modificationHelper, StatementGuidParser $guidParser, LoggerInterface $logger, callable $resultBuilderInstantiator, callable $entitySavingHelperInstantiator, bool $federatedPropertiesEnabled, array $sandboxEntityIds)
 
 isWriteMode ()
 
 needsToken ()
 

Static Public Member Functions

static factory (ApiMain $mainModule, string $moduleName, ApiHelperFactory $apiHelperFactory, DeserializerFactory $deserializerFactory, ChangeOpFactoryProvider $changeOpFactoryProvider, EntityIdParser $entityIdParser, LoggerInterface $logger, SettingsArray $repoSettings, SnakFactory $snakFactory, StatementGuidParser $statementGuidParser, StatementGuidValidator $statementGuidValidator)
 

Protected Member Functions

 getAllowedParams ()
 
 getExamplesMessages ()
 

Protected Attributes

 $errorReporter
 

Private Member Functions

 validateParameters (array $params)
 
 validateReferenceHash (Statement $statement, string $referenceHash)
 
 getArrayFromParam (string $arrayParam, string $parameter)
 
 getChangeOp (Reference $reference)
 
 applyChangeOpAndReturnChangedReference (ChangeOp $changeOp, EntityDocument $entity, Summary $summary, Statement $statement, Reference $newReference)
 Apply $changeop to $entity (updating $summary) and return the Reference that was changed. More...
 

Private Attributes

 $statementChangeOpFactory
 
 $deserializerFactory
 
 $modificationHelper
 
 $guidParser
 
 $logger
 
 $resultBuilder
 
 $entitySavingHelper
 
 $sandboxEntityIds
 

Detailed Description

API module for creating a reference or setting the value of an existing one.

Author
Jeroen De Dauw < jeroe.nosp@m.nded.nosp@m.auw@g.nosp@m.mail.nosp@m..com >
Tobias Gritschacher < tobia.nosp@m.s.gr.nosp@m.itsch.nosp@m.ache.nosp@m.r@wik.nosp@m.imed.nosp@m.ia.de >

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\Api\SetReference::__construct ( ApiMain  $mainModule,
string  $moduleName,
DeserializerFactory  $deserializerFactory,
ApiErrorReporter  $errorReporter,
StatementChangeOpFactory  $statementChangeOpFactory,
StatementModificationHelper  $modificationHelper,
StatementGuidParser  $guidParser,
LoggerInterface  $logger,
callable  $resultBuilderInstantiator,
callable  $entitySavingHelperInstantiator,
bool  $federatedPropertiesEnabled,
array  $sandboxEntityIds 
)

Member Function Documentation

◆ applyChangeOpAndReturnChangedReference()

Wikibase\Repo\Api\SetReference::applyChangeOpAndReturnChangedReference ( ChangeOp  $changeOp,
EntityDocument  $entity,
Summary  $summary,
Statement  $statement,
Reference  $newReference 
)
private

Apply $changeop to $entity (updating $summary) and return the Reference that was changed.

(Due to data value normalization in the ChangeOp factory, this may not be the exact same reference as $newReference.)

◆ factory()

static Wikibase\Repo\Api\SetReference::factory ( ApiMain  $mainModule,
string  $moduleName,
ApiHelperFactory  $apiHelperFactory,
DeserializerFactory  $deserializerFactory,
ChangeOpFactoryProvider  $changeOpFactoryProvider,
EntityIdParser  $entityIdParser,
LoggerInterface  $logger,
SettingsArray  $repoSettings,
SnakFactory  $snakFactory,
StatementGuidParser  $statementGuidParser,
StatementGuidValidator  $statementGuidValidator 
)
static

◆ getAllowedParams()

Wikibase\Repo\Api\SetReference::getAllowedParams ( )
protected

◆ getArrayFromParam()

Wikibase\Repo\Api\SetReference::getArrayFromParam ( string  $arrayParam,
string  $parameter 
)
private

◆ getChangeOp()

Wikibase\Repo\Api\SetReference::getChangeOp ( Reference  $reference)
private

◆ getExamplesMessages()

Wikibase\Repo\Api\SetReference::getExamplesMessages ( )
protected

◆ isWriteMode()

Wikibase\Repo\Api\SetReference::isWriteMode ( )

◆ needsToken()

Wikibase\Repo\Api\SetReference::needsToken ( )
See also
ApiBase::needsToken
Returns
string

◆ validateParameters()

Wikibase\Repo\Api\SetReference::validateParameters ( array  $params)
private

◆ validateReferenceHash()

Wikibase\Repo\Api\SetReference::validateReferenceHash ( Statement  $statement,
string  $referenceHash 
)
private

Member Data Documentation

◆ $deserializerFactory

Wikibase\Repo\Api\SetReference::$deserializerFactory
private

◆ $entitySavingHelper

Wikibase\Repo\Api\SetReference::$entitySavingHelper
private

◆ $errorReporter

Wikibase\Repo\Api\SetReference::$errorReporter
protected

◆ $guidParser

Wikibase\Repo\Api\SetReference::$guidParser
private

◆ $logger

Wikibase\Repo\Api\SetReference::$logger
private

◆ $modificationHelper

Wikibase\Repo\Api\SetReference::$modificationHelper
private

◆ $resultBuilder

Wikibase\Repo\Api\SetReference::$resultBuilder
private

◆ $sandboxEntityIds

Wikibase\Repo\Api\SetReference::$sandboxEntityIds
private

◆ $statementChangeOpFactory

Wikibase\Repo\Api\SetReference::$statementChangeOpFactory
private

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