Daniel Kinzler has uploaded a new change for review.

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


Change subject: Introducing EntityTitleLookup
......................................................................

Introducing EntityTitleLookup

EntityTitleLookup represents a mapping from EntityId to Title.

Change-Id: Iaf0db8e51fd00379a69413980e9b08982b6cd57e
---
M lib/WikibaseLib.classes.php
A lib/includes/store/EntityTitleLookup.php
M repo/includes/content/EntityContentFactory.php
3 files changed, 53 insertions(+), 1 deletion(-)


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

diff --git a/lib/WikibaseLib.classes.php b/lib/WikibaseLib.classes.php
index 3daf5e1..3330036 100644
--- a/lib/WikibaseLib.classes.php
+++ b/lib/WikibaseLib.classes.php
@@ -128,6 +128,7 @@
                'Wikibase\EntityLookup' => 'includes/store/EntityLookup.php',
                'Wikibase\EntityRevision' => 
'includes/store/EntityRevision.php',
                'Wikibase\EntityRevisionLookup' => 
'includes/store/EntityRevisionLookup.php',
+               'Wikibase\EntityTitleLookup' => 
'includes/store/EntityTitleLookup.php',
                'Wikibase\PropertyLabelResolver' => 
'includes/store/PropertyLabelResolver.php',
                'Wikibase\EntityUsageIndex' => 
'includes/store/EntityUsageIndex.php',
                'Wikibase\SiteLinkCache' => 'includes/store/SiteLinkCache.php',
diff --git a/lib/includes/store/EntityTitleLookup.php 
b/lib/includes/store/EntityTitleLookup.php
new file mode 100644
index 0000000..08f18cf
--- /dev/null
+++ b/lib/includes/store/EntityTitleLookup.php
@@ -0,0 +1,51 @@
+<?php
+
+namespace Wikibase;
+use MWException;
+use Title;
+
+/**
+ * Represents a mapping from entity IDs to wiki page titles.
+ * The mapping could be programmatic, or it could be based on database lookups.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @since 0.4
+ *
+ * @file
+ * @ingroup WikibaseLib
+ *
+ * @licence GNU GPL v2+
+ * @author Daniel Kinzler
+ */
+interface EntityTitleLookup {
+
+       /**
+        * Returns the Title for the given entity.
+        *
+        * If the entity does not exist, this method will return either null,
+        * or a Title object referring to a page that does not exist.
+        *
+        * @since 0.4
+        *
+        * @param EntityId $id
+        *
+        * @throws MWException
+        * @return Title|null
+        */
+       public function getTitleForId( EntityId $id );
+
+}
diff --git a/repo/includes/content/EntityContentFactory.php 
b/repo/includes/content/EntityContentFactory.php
index cad6027..666c4d8 100644
--- a/repo/includes/content/EntityContentFactory.php
+++ b/repo/includes/content/EntityContentFactory.php
@@ -36,7 +36,7 @@
  * @licence GNU GPL v2+
  * @author Jeroen De Dauw < [email protected] >
  */
-class EntityContentFactory {
+class EntityContentFactory implements EntityTitleLookup {
 
        /**
         * @since 0.2

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

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

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

Reply via email to