Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Repo\ChangeOp\ChangeOpStatement Class Reference

Class for statement modification operations. More...

+ Inheritance diagram for Wikibase\Repo\ChangeOp\ChangeOpStatement:
+ Collaboration diagram for Wikibase\Repo\ChangeOp\ChangeOpStatement:

Public Member Functions

 __construct (Statement $statement, GuidGenerator $guidGenerator, StatementGuidValidator $guidValidator, StatementGuidParser $guidParser, SnakValidator $snakValidator, $index=null)
 
 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

 
 validate (EntityDocument $entity)
 
- Public Member Functions inherited from Wikibase\Repo\ChangeOp\ChangeOpBase
 getActions ()
 

Private Member Functions

 validateStatementGuid (EntityId $entityId)
 
 removeStatement (StatementList $statements)
 
 checkMainSnakUpdate (Statement $oldStatement)
 Checks that the update of the main snak is permissible.
 
 addStatementToGroup (StatementList $statements, $index)
 

Private Attributes

 $statement
 
 $guidGenerator
 
 $guidValidator
 
 $guidParser
 
 $snakValidator
 
 $index
 

Additional Inherited Members

- Protected Member Functions inherited from Wikibase\Repo\ChangeOp\ChangeOpBase
 updateSummary (?Summary $summary, $action, $language='', $args='')
 

Detailed Description

Class for statement modification operations.

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\ChangeOp\ChangeOpStatement::__construct ( Statement  $statement,
GuidGenerator  $guidGenerator,
StatementGuidValidator  $guidValidator,
StatementGuidParser  $guidParser,
SnakValidator  $snakValidator,
  $index = null 
)
Parameters
Statement$statement
GuidGenerator$guidGenerator
StatementGuidValidator$guidValidator
StatementGuidParser$guidParser
SnakValidator$snakValidator
int | null$indexWhere the statement should be placed among the other statements.
Exceptions
InvalidArgumentException

Member Function Documentation

◆ addStatementToGroup()

Wikibase\Repo\ChangeOp\ChangeOpStatement::addStatementToGroup ( StatementList  $statements,
  $index 
)
private
Parameters
StatementList$statements
int$index
Returns
PropertyIdProvider[]

◆ apply()

Wikibase\Repo\ChangeOp\ChangeOpStatement::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

Implements Wikibase\Repo\ChangeOp\ChangeOp.

◆ checkMainSnakUpdate()

Wikibase\Repo\ChangeOp\ChangeOpStatement::checkMainSnakUpdate ( Statement  $oldStatement)
private

Checks that the update of the main snak is permissible.

This checks that the main snaks of the old and the new statement refer to the same property.

Parameters
Statement$oldStatement
Exceptions
ChangeOpExceptionIf the main snak update is illegal.

◆ removeStatement()

Wikibase\Repo\ChangeOp\ChangeOpStatement::removeStatement ( StatementList  $statements)
private
Parameters
StatementList$statements
Returns
int|null

◆ validate()

Wikibase\Repo\ChangeOp\ChangeOpStatement::validate ( EntityDocument  $entity)
See also
ChangeOp::validate
Parameters
EntityDocument$entity
Returns
Result

Implements Wikibase\Repo\ChangeOp\ChangeOp.

◆ validateStatementGuid()

Wikibase\Repo\ChangeOp\ChangeOpStatement::validateStatementGuid ( EntityId  $entityId)
private
Parameters
EntityId$entityId
Exceptions
ChangeOpException

Member Data Documentation

◆ $guidGenerator

Wikibase\Repo\ChangeOp\ChangeOpStatement::$guidGenerator
private

◆ $guidParser

Wikibase\Repo\ChangeOp\ChangeOpStatement::$guidParser
private

◆ $guidValidator

Wikibase\Repo\ChangeOp\ChangeOpStatement::$guidValidator
private

◆ $index

Wikibase\Repo\ChangeOp\ChangeOpStatement::$index
private

◆ $snakValidator

Wikibase\Repo\ChangeOp\ChangeOpStatement::$snakValidator
private

◆ $statement

Wikibase\Repo\ChangeOp\ChangeOpStatement::$statement
private

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