Bene has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/266746

Change subject: Fix array keys for external identifier datatype
......................................................................

Fix array keys for external identifier datatype

The definition was wrong in WikibaseRepo where it was just PT:id instead
of PT:external-id. Furthermore, in the SnakFormatter dispatching we need
to add the PT prefix in order to get the correct formatter.

Bug: T124902
Change-Id: I1101538b245b7e9d79f77100abf73115cbdf81d9
---
M lib/includes/formatters/DispatchingSnakFormatter.php
M repo/WikibaseRepo.datatypes.php
2 files changed, 3 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/46/266746/1

diff --git a/lib/includes/formatters/DispatchingSnakFormatter.php 
b/lib/includes/formatters/DispatchingSnakFormatter.php
index 9e27d59..4f08cb7 100644
--- a/lib/includes/formatters/DispatchingSnakFormatter.php
+++ b/lib/includes/formatters/DispatchingSnakFormatter.php
@@ -141,8 +141,8 @@
 
                $dataType = $this->getSnakDataType( $snak );
 
-               if ( isset( $this->formattersByDataType[$dataType] ) ) {
-                       $formatter = $this->formattersByDataType[$dataType];
+               if ( isset( $this->formattersByDataType["PT:$dataType"] ) ) {
+                       $formatter = 
$this->formattersByDataType["PT:$dataType"];
                        return $formatter->formatSnak( $snak );
                }
 
diff --git a/repo/WikibaseRepo.datatypes.php b/repo/WikibaseRepo.datatypes.php
index 2078091..6521acf 100644
--- a/repo/WikibaseRepo.datatypes.php
+++ b/repo/WikibaseRepo.datatypes.php
@@ -242,7 +242,7 @@
                                return new ObjectUriRdfBuilder();
                        },
                ),
-               'PT:id' => array(
+               'PT:external-id' => array(
                        'validator-factory-callback' => function() {
                                $factory = 
WikibaseRepo::getDefaultValidatorBuilders();
                                return $factory->buildStringValidators();

-- 
To view, visit https://gerrit.wikimedia.org/r/266746
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1101538b245b7e9d79f77100abf73115cbdf81d9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Bene <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to