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

Derived class for API modules modifying a single entity identified by id xor a combination of site and page title. More...

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

Public Member Functions

 __construct (ApiMain $mainModule, string $moduleName, IBufferingStatsdDataFactory $statsdDataFactory, EntityRevisionLookup $revisionLookup, EntityIdParser $idParser, array $propertyDataTypes, EntityChangeOpProvider $entityChangeOpProvider, EditSummaryHelper $editSummaryHelper, bool $federatedPropertiesEnabled, array $sandboxEntityIds)
 
 needsToken ()
 
 isWriteMode ()
 
- Public Member Functions inherited from Wikibase\Repo\Api\ModifyEntity
 __construct (ApiMain $mainModule, string $moduleName, bool $federatedPropertiesEnabled, string $modulePrefix='')
 
 setServices (SiteLinkGlobalIdentifiersProvider $siteLinkGlobalIdentifiersProvider)
 
 execute ()
 
 isFreshIdAssigned ()
 Return whether a fresh id is assigned or not.
 

Static Public Member Functions

static factory (ApiMain $mainModule, string $moduleName, IBufferingStatsdDataFactory $statsdDataFactory, DataTypeDefinitions $dataTypeDefinitions, EntityChangeOpProvider $entityChangeOpProvider, EntityIdParser $entityIdParser, SettingsArray $settings, Store $store)
 

Public Attributes

const PARAM_DATA = 'data'
 
const PARAM_CLEAR = 'clear'
 

Protected Member Functions

 prepareParameters (array $params)
 
 validateEntitySpecificParameters (array $preparedParameters, EntityDocument $entity, int $baseRevId)
 
 modifyEntity (EntityDocument $entity, ChangeOp $changeOp, array $preparedParameters)
 Actually modify the entity.
 
 getChangeOp (array $preparedParameters, EntityDocument $entity)
 
 getAllowedParams ()
 
 getExamplesMessages ()
 
- Protected Member Functions inherited from Wikibase\Repo\Api\ModifyEntity
 getTitleLookup ()
 
 getResultBuilder ()
 
 createSummary (array $params)
 Create 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.
 
 validateParameters (array $params)
 Make sure the required parameters are provided and that they are valid.
 

Private Member Functions

 entityExists (EntityId $entityId)
 
 getSummary (array $preparedParameters, EntityDocument $entity, ChangeOpResult $changeOpResult)
 
 isUpdatingExistingEntity (array $preparedParameters)
 
 validateDataParameter (array $params)
 
 validateDataProperties ( $data, EntityDocument $entity, int $revisionId)
 
 checkValidJson ( $data)
 
 checkPageIdProp (array $data, ?Title $title)
 
 checkNamespaceProp (array $data, ?Title $title)
 
 checkTitleProp (array $data, ?Title $title)
 
 checkRevisionProp (array $data, int $revisionId)
 
 checkEntityId (array $data, ?EntityId $entityId)
 
 checkEntityType (array $data, EntityDocument $entity)
 
 assertArray ( $value, string $message)
 
 assertString ( $value, string $message)
 
 assertType (string $type, $value, string $message)
 
 dieIfNotClearable (EntityDocument $entity)
 

Private Attributes

 $statsdDataFactory
 
 $revisionLookup
 
 $idParser
 
 $propertyDataTypes
 
 $entityChangeOpProvider
 
 $editSummaryHelper
 
 $sandboxEntityIds
 

Additional Inherited Members

- Protected Attributes inherited from Wikibase\Repo\Api\ModifyEntity
 $stringNormalizer
 
 $siteLinkGlobalIdentifiersProvider
 
 $siteLinkGroups
 
 $badgeItems
 
 $errorReporter
 
 $enabledEntityTypes
 

Detailed Description

Derived class for API modules modifying a single entity identified by id xor a combination of site and page title.

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\Api\EditEntity::__construct ( ApiMain $mainModule,
string $moduleName,
IBufferingStatsdDataFactory $statsdDataFactory,
EntityRevisionLookup $revisionLookup,
EntityIdParser $idParser,
array $propertyDataTypes,
EntityChangeOpProvider $entityChangeOpProvider,
EditSummaryHelper $editSummaryHelper,
bool $federatedPropertiesEnabled,
array $sandboxEntityIds )

Member Function Documentation

◆ assertArray()

Wikibase\Repo\Api\EditEntity::assertArray ( $value,
string $message )
private
Parameters
mixed$value
string$message

◆ assertString()

Wikibase\Repo\Api\EditEntity::assertString ( $value,
string $message )
private
Parameters
mixed$value
string$message

◆ assertType()

Wikibase\Repo\Api\EditEntity::assertType ( string $type,
$value,
string $message )
private
Parameters
string$type
mixed$value
string$message

◆ checkEntityId()

Wikibase\Repo\Api\EditEntity::checkEntityId ( array $data,
?EntityId $entityId )
private

◆ checkEntityType()

Wikibase\Repo\Api\EditEntity::checkEntityType ( array $data,
EntityDocument $entity )
private

◆ checkNamespaceProp()

Wikibase\Repo\Api\EditEntity::checkNamespaceProp ( array $data,
?Title $title )
private

◆ checkPageIdProp()

Wikibase\Repo\Api\EditEntity::checkPageIdProp ( array $data,
?Title $title )
private

◆ checkRevisionProp()

Wikibase\Repo\Api\EditEntity::checkRevisionProp ( array $data,
int $revisionId )
private

◆ checkTitleProp()

Wikibase\Repo\Api\EditEntity::checkTitleProp ( array $data,
?Title $title )
private

◆ checkValidJson()

Wikibase\Repo\Api\EditEntity::checkValidJson ( $data)
private
Parameters
mixed$data

◆ dieIfNotClearable()

Wikibase\Repo\Api\EditEntity::dieIfNotClearable ( EntityDocument $entity)
private

◆ entityExists()

Wikibase\Repo\Api\EditEntity::entityExists ( EntityId $entityId)
private
Parameters
EntityId$entityId
Returns
bool

◆ factory()

static Wikibase\Repo\Api\EditEntity::factory ( ApiMain $mainModule,
string $moduleName,
IBufferingStatsdDataFactory $statsdDataFactory,
DataTypeDefinitions $dataTypeDefinitions,
EntityChangeOpProvider $entityChangeOpProvider,
EntityIdParser $entityIdParser,
SettingsArray $settings,
Store $store )
static

◆ getAllowedParams()

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

Reimplemented from Wikibase\Repo\Api\ModifyEntity.

◆ getChangeOp()

Wikibase\Repo\Api\EditEntity::getChangeOp ( array $preparedParameters,
EntityDocument $entity )
protected
Parameters
array$preparedParameters
EntityDocument$entity
Exceptions
ApiUsageException
Returns
ChangeOp

Reimplemented from Wikibase\Repo\Api\ModifyEntity.

◆ getExamplesMessages()

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

◆ getSummary()

Wikibase\Repo\Api\EditEntity::getSummary ( array $preparedParameters,
EntityDocument $entity,
ChangeOpResult $changeOpResult )
private

◆ isUpdatingExistingEntity()

Wikibase\Repo\Api\EditEntity::isUpdatingExistingEntity ( array $preparedParameters)
private

◆ isWriteMode()

Wikibase\Repo\Api\EditEntity::isWriteMode ( )
See also
ApiBase::isWriteMode()
Returns
bool Always true.

◆ modifyEntity()

Wikibase\Repo\Api\EditEntity::modifyEntity ( EntityDocument $entity,
ChangeOp $changeOp,
array $preparedParameters )
protected

Actually modify the entity.

Parameters
EntityDocument$entity
ChangeOp$changeOp
array$preparedParameters
Returns
Summary|null a summary of the modification, or null to indicate failure.

Reimplemented from Wikibase\Repo\Api\ModifyEntity.

◆ needsToken()

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

◆ prepareParameters()

Wikibase\Repo\Api\EditEntity::prepareParameters ( array $params)
protected
Parameters
array$params
Returns
array

Reimplemented from Wikibase\Repo\Api\ModifyEntity.

◆ validateDataParameter()

Wikibase\Repo\Api\EditEntity::validateDataParameter ( array $params)
private

◆ validateDataProperties()

Wikibase\Repo\Api\EditEntity::validateDataProperties ( $data,
EntityDocument $entity,
int $revisionId )
private
Parameters
mixed$data
EntityDocument$entity
int$revisionId

◆ validateEntitySpecificParameters()

Wikibase\Repo\Api\EditEntity::validateEntitySpecificParameters ( array $preparedParameters,
EntityDocument $entity,
int $baseRevId )
protected

Reimplemented from Wikibase\Repo\Api\ModifyEntity.

Member Data Documentation

◆ $editSummaryHelper

Wikibase\Repo\Api\EditEntity::$editSummaryHelper
private

◆ $entityChangeOpProvider

Wikibase\Repo\Api\EditEntity::$entityChangeOpProvider
private

◆ $idParser

Wikibase\Repo\Api\EditEntity::$idParser
private

◆ $propertyDataTypes

Wikibase\Repo\Api\EditEntity::$propertyDataTypes
private

◆ $revisionLookup

Wikibase\Repo\Api\EditEntity::$revisionLookup
private

◆ $sandboxEntityIds

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

◆ $statsdDataFactory

Wikibase\Repo\Api\EditEntity::$statsdDataFactory
private

◆ PARAM_CLEAR

const Wikibase\Repo\Api\EditEntity::PARAM_CLEAR = 'clear'

◆ PARAM_DATA

const Wikibase\Repo\Api\EditEntity::PARAM_DATA = 'data'

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