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

Class for mainsnak change operation. More...

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

Public Member Functions

 __construct ( $statementGuid, Snak $snak, GuidGenerator $guidGenerator, SnakValidator $snakValidator)
 Constructs a new mainsnak change operation.
 
 getStatementGuid ()
 
 apply (EntityDocument $entity, Summary $summary=null)
 
 validate (EntityDocument $entity)
 
- Public Member Functions inherited from Wikibase\Repo\ChangeOp\ChangeOpBase
 getActions ()
 

Protected Member Functions

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

Private Member Functions

 addStatement (StatementList $statements, EntityId $entityId, Summary $summary=null)
 
 setStatement (StatementList $statements, Summary $summary=null)
 

Private Attributes

 $statementGuid
 
 $snak
 
 $guidGenerator
 
 $snakValidator
 

Detailed Description

Class for mainsnak change operation.

Author
Tobias Gritschacher < tobia.nosp@m.s.gr.nosp@m.itsch.nosp@m.ache.nosp@m.r@wik.nosp@m.imed.nosp@m.ia.de >
Daniel Kinzler
Bene* < benes.nosp@m.tar..nosp@m.wikim.nosp@m.edia.nosp@m.@gmai.nosp@m.l.co.nosp@m.m >

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\ChangeOp\ChangeOpMainSnak::__construct ( $statementGuid,
Snak $snak,
GuidGenerator $guidGenerator,
SnakValidator $snakValidator )

Constructs a new mainsnak change operation.

Parameters
string$statementGuid
Snak$snak
GuidGenerator$guidGenerator
SnakValidator$snakValidator
Exceptions
InvalidArgumentException

Member Function Documentation

◆ addStatement()

Wikibase\Repo\ChangeOp\ChangeOpMainSnak::addStatement ( StatementList $statements,
EntityId $entityId,
Summary $summary = null )
private
Parameters
StatementList$statements
EntityId$entityId
Summary | null$summary

◆ apply()

Wikibase\Repo\ChangeOp\ChangeOpMainSnak::apply ( EntityDocument $entity,
Summary $summary = null )
  • a new claim with $snak as mainsnak gets added when $claimGuid is empty and $snak is set
  • the claim's mainsnak gets set to $snak when $claimGuid and $snak are set

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.

◆ getClaimSummaryArgs()

Wikibase\Repo\ChangeOp\ChangeOpMainSnak::getClaimSummaryArgs ( Snak $mainSnak)
protected
Parameters
Snak$mainSnak
Returns
array

◆ getStatementGuid()

Wikibase\Repo\ChangeOp\ChangeOpMainSnak::getStatementGuid ( )
Returns
string

◆ setStatement()

Wikibase\Repo\ChangeOp\ChangeOpMainSnak::setStatement ( StatementList $statements,
Summary $summary = null )
private
Parameters
StatementList$statements
Summary | null$summary
Exceptions
ChangeOpException

◆ validate()

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

Implements Wikibase\Repo\ChangeOp\ChangeOp.

Member Data Documentation

◆ $guidGenerator

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

◆ $snak

Wikibase\Repo\ChangeOp\ChangeOpMainSnak::$snak
private

◆ $snakValidator

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

◆ $statementGuid

Wikibase\Repo\ChangeOp\ChangeOpMainSnak::$statementGuid
private

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