[MediaWiki-commits] [Gerrit] mediawiki...Wikibase[master]: Inject SetClaimValue dependencies
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/338094 ) Change subject: Inject SetClaimValue dependencies .. Inject SetClaimValue dependencies Bug: T158293 Change-Id: Iba5894140fd5f24e379672d78f6781be3ff27dad --- M repo/Wikibase.php M repo/includes/Api/SetClaimValue.php 2 files changed, 53 insertions(+), 22 deletions(-) Approvals: jenkins-bot: Verified Thiemo Mättig (WMDE): Looks good to me, approved diff --git a/repo/Wikibase.php b/repo/Wikibase.php index 50671c3..af1190a 100644 --- a/repo/Wikibase.php +++ b/repo/Wikibase.php @@ -337,7 +337,36 @@ ); } ]; - $wgAPIModules['wbsetclaimvalue'] = Wikibase\Repo\Api\SetClaimValue::class; + $wgAPIModules['wbsetclaimvalue'] = [ + 'class' => Wikibase\Repo\Api\SetClaimValue::class, + 'factory' => function( ApiMain $mainModule, $moduleName ) { + $wikibaseRepo = Wikibase\Repo\WikibaseRepo::getDefaultInstance(); + $apiHelperFactory = $wikibaseRepo->getApiHelperFactory( $mainModule->getContext() ); + $changeOpFactoryProvider = $wikibaseRepo->getChangeOpFactoryProvider(); + + $modificationHelper = new Wikibase\Repo\Api\StatementModificationHelper( + $wikibaseRepo->getSnakFactory(), + $wikibaseRepo->getEntityIdParser(), + $wikibaseRepo->getStatementGuidValidator(), + $apiHelperFactory->getErrorReporter( $mainModule ) + ); + + return new Wikibase\Repo\Api\SetClaimValue( + $mainModule, + $moduleName, + $apiHelperFactory->getErrorReporter( $mainModule ), + $changeOpFactoryProvider->getStatementChangeOpFactory(), + $modificationHelper, + $wikibaseRepo->getStatementGuidParser(), + function ( $module ) use ( $apiHelperFactory ) { + return $apiHelperFactory->getResultBuilder( $module ); + }, + function ( $module ) use ( $apiHelperFactory ) { + return $apiHelperFactory->getEntitySavingHelper( $module ); + } + ); + } + ]; $wgAPIModules['wbsetreference'] = Wikibase\Repo\Api\SetReference::class; $wgAPIModules['wbremovereferences'] = Wikibase\Repo\Api\RemoveReferences::class; $wgAPIModules['wbsetclaim'] = Wikibase\Repo\Api\SetClaim::class; diff --git a/repo/includes/Api/SetClaimValue.php b/repo/includes/Api/SetClaimValue.php index cf0a7d3..3a84264 100644 --- a/repo/includes/Api/SetClaimValue.php +++ b/repo/includes/Api/SetClaimValue.php @@ -50,28 +50,30 @@ /** * @param ApiMain $mainModule * @param string $moduleName -* @param string $modulePrefix +* @param string $errorReporter +* @param StatementChangeOpFactory $statementChangeOpFactory +* @param StatementModificationHelper $modificationHelper +* @param StatementGuidParser $guidParser +* @param callable $resultBuilderInstantiator +* @param callable $entitySavingHelperInstantiator */ - public function __construct( ApiMain $mainModule, $moduleName, $modulePrefix = '' ) { - parent::__construct( $mainModule, $moduleName, $modulePrefix ); - - $wikibaseRepo = WikibaseRepo::getDefaultInstance(); - $apiHelperFactory = $wikibaseRepo->getApiHelperFactory( $this->getContext() ); - $changeOpFactoryProvider = $wikibaseRepo->getChangeOpFactoryProvider(); - - $this->errorReporter = $apiHelperFactory->getErrorReporter( $this ); - $this->statementChangeOpFactory = $changeOpFactoryProvider->getStatementChangeOpFactory(); - - $this->modificationHelper = new StatementModificationHelper( - $wikibaseRepo->getSnakFactory(), - $wikibaseRepo->getEntityIdParser(), - $wikibaseRepo->getStatementGuidValidator(), - $apiHelperFactory->getErrorReporter( $this ) - ); - - $this->guidParser = $wikibaseRepo->getStatementGuidParser(); - $this->resultBuilder = $apiHelperFactory->getResultBuilder( $this ); - $this->entitySavingHelper = $apiHelperFactory->getEntitySavingHelper( $this ); + public function __construct( + ApiMain $mainModule, + $moduleName, + $errorReporter, +
[MediaWiki-commits] [Gerrit] mediawiki...Wikibase[master]: Inject SetClaimValue dependencies
Ladsgroup has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/338094 ) Change subject: Inject SetClaimValue dependencies .. Inject SetClaimValue dependencies Bug: T158293 Change-Id: Iba5894140fd5f24e379672d78f6781be3ff27dad --- M repo/Wikibase.php M repo/includes/Api/SetClaimValue.php 2 files changed, 53 insertions(+), 22 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/94/338094/1 diff --git a/repo/Wikibase.php b/repo/Wikibase.php index 50671c3..af1190a 100644 --- a/repo/Wikibase.php +++ b/repo/Wikibase.php @@ -337,7 +337,36 @@ ); } ]; - $wgAPIModules['wbsetclaimvalue'] = Wikibase\Repo\Api\SetClaimValue::class; + $wgAPIModules['wbsetclaimvalue'] = [ + 'class' => Wikibase\Repo\Api\SetClaimValue::class, + 'factory' => function( ApiMain $mainModule, $moduleName ) { + $wikibaseRepo = Wikibase\Repo\WikibaseRepo::getDefaultInstance(); + $apiHelperFactory = $wikibaseRepo->getApiHelperFactory( $mainModule->getContext() ); + $changeOpFactoryProvider = $wikibaseRepo->getChangeOpFactoryProvider(); + + $modificationHelper = new Wikibase\Repo\Api\StatementModificationHelper( + $wikibaseRepo->getSnakFactory(), + $wikibaseRepo->getEntityIdParser(), + $wikibaseRepo->getStatementGuidValidator(), + $apiHelperFactory->getErrorReporter( $mainModule ) + ); + + return new Wikibase\Repo\Api\SetClaimValue( + $mainModule, + $moduleName, + $apiHelperFactory->getErrorReporter( $mainModule ), + $changeOpFactoryProvider->getStatementChangeOpFactory(), + $modificationHelper, + $wikibaseRepo->getStatementGuidParser(), + function ( $module ) use ( $apiHelperFactory ) { + return $apiHelperFactory->getResultBuilder( $module ); + }, + function ( $module ) use ( $apiHelperFactory ) { + return $apiHelperFactory->getEntitySavingHelper( $module ); + } + ); + } + ]; $wgAPIModules['wbsetreference'] = Wikibase\Repo\Api\SetReference::class; $wgAPIModules['wbremovereferences'] = Wikibase\Repo\Api\RemoveReferences::class; $wgAPIModules['wbsetclaim'] = Wikibase\Repo\Api\SetClaim::class; diff --git a/repo/includes/Api/SetClaimValue.php b/repo/includes/Api/SetClaimValue.php index cf0a7d3..3a84264 100644 --- a/repo/includes/Api/SetClaimValue.php +++ b/repo/includes/Api/SetClaimValue.php @@ -50,28 +50,30 @@ /** * @param ApiMain $mainModule * @param string $moduleName -* @param string $modulePrefix +* @param string $errorReporter +* @param StatementChangeOpFactory $statementChangeOpFactory +* @param StatementModificationHelper $modificationHelper +* @param StatementGuidParser $guidParser +* @param callable $resultBuilderInstantiator +* @param callable $entitySavingHelperInstantiator */ - public function __construct( ApiMain $mainModule, $moduleName, $modulePrefix = '' ) { - parent::__construct( $mainModule, $moduleName, $modulePrefix ); - - $wikibaseRepo = WikibaseRepo::getDefaultInstance(); - $apiHelperFactory = $wikibaseRepo->getApiHelperFactory( $this->getContext() ); - $changeOpFactoryProvider = $wikibaseRepo->getChangeOpFactoryProvider(); - - $this->errorReporter = $apiHelperFactory->getErrorReporter( $this ); - $this->statementChangeOpFactory = $changeOpFactoryProvider->getStatementChangeOpFactory(); - - $this->modificationHelper = new StatementModificationHelper( - $wikibaseRepo->getSnakFactory(), - $wikibaseRepo->getEntityIdParser(), - $wikibaseRepo->getStatementGuidValidator(), - $apiHelperFactory->getErrorReporter( $this ) - ); - - $this->guidParser = $wikibaseRepo->getStatementGuidParser(); - $this->resultBuilder = $apiHelperFactory->getResultBuilder( $this ); - $this->entitySavingHelper = $apiHelperFactory->getEntitySavingHelper( $this ); + public function __construct( + ApiMain $mainModule, + $moduleName, + $errorReporter, +