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

Class for qualifier change operation. More...

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

Public Member Functions

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

Protected Member Functions

 addQualifier (SnakList $qualifiers, Summary $summary=null)
 
 setQualifier (SnakList $qualifiers, Summary $summary=null)
 
 getSnakSummaryArgs (Snak $snak)
 
- Protected Member Functions inherited from Wikibase\Repo\ChangeOp\ChangeOpBase
 updateSummary (?Summary $summary, $action, $language='', $args='')
 

Private Attributes

 $statementGuid
 
 $snak
 
 $snakHash
 
 $snakValidator
 

Detailed Description

Class for qualifier 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

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\ChangeOp\ChangeOpQualifier::__construct ( $statementGuid,
Snak $snak,
$snakHash,
SnakValidator $snakValidator )

Constructs a new qualifier change operation.

Parameters
string$statementGuid
Snak$snak
string$snakHash
SnakValidator$snakValidator
Exceptions
InvalidArgumentException

Member Function Documentation

◆ addQualifier()

Wikibase\Repo\ChangeOp\ChangeOpQualifier::addQualifier ( SnakList $qualifiers,
Summary $summary = null )
protected
Parameters
SnakList$qualifiers
Summary | null$summary
Exceptions
ChangeOpException

◆ apply()

Wikibase\Repo\ChangeOp\ChangeOpQualifier::apply ( EntityDocument $entity,
Summary $summary = null )
  • a new qualifier gets added when $snakHash is empty and $snak is set
  • the qualifier gets set to $snak when $snakHash 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.

◆ getSnakSummaryArgs()

Wikibase\Repo\ChangeOp\ChangeOpQualifier::getSnakSummaryArgs ( Snak $snak)
protected
Parameters
Snak$snak
Returns
array

◆ setQualifier()

Wikibase\Repo\ChangeOp\ChangeOpQualifier::setQualifier ( SnakList $qualifiers,
Summary $summary = null )
protected
Parameters
SnakList$qualifiers
Summary | null$summary
Exceptions
ChangeOpException

◆ validate()

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

Implements Wikibase\Repo\ChangeOp\ChangeOp.

Member Data Documentation

◆ $snak

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

◆ $snakHash

Wikibase\Repo\ChangeOp\ChangeOpQualifier::$snakHash
private

◆ $snakValidator

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

◆ $statementGuid

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

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