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

Class for label change operation. More...

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

Public Member Functions

 __construct ( $languageCode, $label, TermValidatorFactory $termValidatorFactory)
 
 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)
 
 getActions ()
 

Private Member Functions

 updateLabels (TermList $labels)
 Applies the change to the labels.
 
 buildResult (EntityId $entityId=null, Term $oldLabel=null, Term $newLabel=null)
 

Private Attributes

 $languageCode
 
 $label
 
 $termValidatorFactory
 

Additional Inherited Members

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

Detailed Description

Class for label 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
Thiemo Kreuz

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\ChangeOp\ChangeOpLabel::__construct ( $languageCode,
$label,
TermValidatorFactory $termValidatorFactory )
Parameters
string$languageCode
string | null$label
TermValidatorFactory$termValidatorFactory
Exceptions
InvalidArgumentException

Member Function Documentation

◆ apply()

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

◆ buildResult()

Wikibase\Repo\ChangeOp\ChangeOpLabel::buildResult ( EntityId $entityId = null,
Term $oldLabel = null,
Term $newLabel = null )
private
Parameters
EntityId | null$entityId
Term | null$oldLabel
Term | null$newLabel
Returns
ChangeOpLabelResult

◆ getActions()

Wikibase\Repo\ChangeOp\ChangeOpLabel::getActions ( )
See also
ChangeOp::getActions
Returns
string[]

Reimplemented from Wikibase\Repo\ChangeOp\ChangeOpBase.

◆ updateLabels()

Wikibase\Repo\ChangeOp\ChangeOpLabel::updateLabels ( TermList $labels)
private

Applies the change to the labels.

Parameters
TermList$labels

◆ validate()

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

Implements Wikibase\Repo\ChangeOp\ChangeOp.

Member Data Documentation

◆ $label

Wikibase\Repo\ChangeOp\ChangeOpLabel::$label
private

◆ $languageCode

Wikibase\Repo\ChangeOp\ChangeOpLabel::$languageCode
private

◆ $termValidatorFactory

Wikibase\Repo\ChangeOp\ChangeOpLabel::$termValidatorFactory
private

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