Ladsgroup has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/335161 )
Change subject: Inject SetQualifier dependencies ...................................................................... Inject SetQualifier dependencies Bug: T156688 Change-Id: Icb9a958b155ef4157606cab1f48f5bfbbda1c0da --- M repo/Wikibase.php M repo/includes/Api/SetQualifier.php 2 files changed, 49 insertions(+), 20 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/61/335161/1 diff --git a/repo/Wikibase.php b/repo/Wikibase.php index ec6618c..3cacc44 100644 --- a/repo/Wikibase.php +++ b/repo/Wikibase.php @@ -236,7 +236,32 @@ $wgAPIModules['wbremovereferences'] = Wikibase\Repo\Api\RemoveReferences::class; $wgAPIModules['wbsetclaim'] = Wikibase\Repo\Api\SetClaim::class; $wgAPIModules['wbremovequalifiers'] = Wikibase\Repo\Api\RemoveQualifiers::class; - $wgAPIModules['wbsetqualifier'] = Wikibase\Repo\Api\SetQualifier::class; + $wgAPIModules['wbsetqualifier'] = [ + 'class' => Wikibase\Repo\Api\SetQualifier::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\SetQualifier( + $mainModule, + $moduleName, + $apiHelperFactory->getErrorReporter( $mainModule ), + $changeOpFactoryProvider->getStatementChangeOpFactory(), + $modificationHelper, + $wikibaseRepo->getStatementGuidParser(), + $apiHelperFactory->getResultBuilder( $mainModule ), + $apiHelperFactory->getEntitySavingHelper( $mainModule ) + ); + } + ]; $wgAPIModules['wbmergeitems'] = Wikibase\Repo\Api\MergeItems::class; $wgAPIModules['wbformatvalue'] = [ 'class' => Wikibase\Repo\Api\FormatSnakValue::class, diff --git a/repo/includes/Api/SetQualifier.php b/repo/includes/Api/SetQualifier.php index 975c1d5..1a4eddc 100644 --- a/repo/includes/Api/SetQualifier.php +++ b/repo/includes/Api/SetQualifier.php @@ -54,28 +54,32 @@ /** * @param ApiMain $mainModule * @param string $moduleName - * @param string $modulePrefix + * @param ApiErrorReporter $errorReporter + * @param StatementChangeOpFactory $statementChangeOpFactory + * @param StatementModificationHelper $modificationHelper + * @param StatementGuidParser $guidParser + * @param ResultBuilder $resultBuilder + * @param EntitySavingHelper $entitySavingHelper */ - public function __construct( ApiMain $mainModule, $moduleName, $modulePrefix = '' ) { - parent::__construct( $mainModule, $moduleName, $modulePrefix ); + public function __construct( + ApiMain $mainModule, + $moduleName, + ApiErrorReporter $errorReporter, + StatementChangeOpFactory $statementChangeOpFactory, + StatementModificationHelper $modificationHelper, + StatementGuidParser $guidParser, + ResultBuilder $resultBuilder, + EntitySavingHelper $entitySavingHelper + ) { + parent::__construct( $mainModule, $moduleName ); - $wikibaseRepo = WikibaseRepo::getDefaultInstance(); - $apiHelperFactory = $wikibaseRepo->getApiHelperFactory( $this->getContext() ); - $changeOpFactoryProvider = $wikibaseRepo->getChangeOpFactoryProvider(); + $this->errorReporter = $errorReporter; + $this->statementChangeOpFactory = $statementChangeOpFactory; - $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 ); + $this->modificationHelper = $modificationHelper; + $this->guidParser = $guidParser; + $this->resultBuilder = $resultBuilder; + $this->entitySavingHelper = $entitySavingHelper; } /** -- To view, visit https://gerrit.wikimedia.org/r/335161 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Icb9a958b155ef4157606cab1f48f5bfbbda1c0da Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Ladsgroup <ladsgr...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits