[MediaWiki-commits] [Gerrit] Use getStatements instead of getClaims in EntityContent subc... - change (mediawiki...Wikibase)

2015-07-08 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Use getStatements instead of getClaims in EntityContent 
subclasses
..


Use getStatements instead of getClaims in EntityContent subclasses

Bug: T104895
Change-Id: I0709f49dd46714286b2bc2fc558facc498615701
---
M repo/includes/content/EntityContent.php
M repo/includes/content/ItemContent.php
M repo/includes/content/PropertyContent.php
3 files changed, 23 insertions(+), 8 deletions(-)

Approvals:
  Thiemo Mättig (WMDE): Looks good to me, approved
  jenkins-bot: Verified



diff --git a/repo/includes/content/EntityContent.php 
b/repo/includes/content/EntityContent.php
index 3577335..7323170 100644
--- a/repo/includes/content/EntityContent.php
+++ b/repo/includes/content/EntityContent.php
@@ -740,9 +740,7 @@
 *
 * @see getEntityStatus()
 *
-* Keys used:
-* - wb-status: the entity's status, according to getEntityStatus()
-* - wb-claims: the number of claims in the entity
+* Records the entity's status in the 'wb-status' key.
 *
 * @return array A map from property names to property values.
 */
@@ -751,10 +749,7 @@
return array();
}
 
-   $properties = array(
-   'wb-claims' = count( $this-getEntity()-getClaims() ),
-   );
-
+   $properties = array();
$status = $this-getEntityStatus();
 
if ( $status !== self::STATUS_NONE ) {
diff --git a/repo/includes/content/ItemContent.php 
b/repo/includes/content/ItemContent.php
index ee013da..99fc14c 100644
--- a/repo/includes/content/ItemContent.php
+++ b/repo/includes/content/ItemContent.php
@@ -209,7 +209,8 @@
/**
 * @see EntityContent::getEntityPageProperties
 *
-* Records the number of sitelinks in the 'wb-sitelinks' key.
+* Records the number of statements in the 'wb-claims' key
+* and the number of sitelinks in the 'wb-sitelinks' key.
 *
 * @return array A map from property names to property values.
 */
@@ -219,6 +220,7 @@
}
 
$properties = parent::getEntityPageProperties();
+   $properties['wb-claims'] = 
$this-getItem()-getStatements()-count();
$properties['wb-sitelinks'] = 
$this-getItem()-getSiteLinkList()-count();
 
return $properties;
diff --git a/repo/includes/content/PropertyContent.php 
b/repo/includes/content/PropertyContent.php
index b8b40d0..c8f7c51 100644
--- a/repo/includes/content/PropertyContent.php
+++ b/repo/includes/content/PropertyContent.php
@@ -92,6 +92,24 @@
}
 
/**
+* @see EntityContent::getEntityPageProperties
+*
+* Records the number of statements in the 'wb-claims' key.
+*
+* @return array A map from property names to property values.
+*/
+   public function getEntityPageProperties() {
+   if ( $this-isRedirect() ) {
+   return array();
+   }
+
+   $properties = parent::getEntityPageProperties();
+   $properties['wb-claims'] = 
$this-getProperty()-getStatements()-count();
+
+   return $properties;
+   }
+
+   /**
 * Checks if this PropertyContent is valid for saving.
 *
 * Returns false if the entity does not have a DataType set.

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I0709f49dd46714286b2bc2fc558facc498615701
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Bene benestar.wikime...@gmail.com
Gerrit-Reviewer: Addshore addshorew...@gmail.com
Gerrit-Reviewer: Jeroen De Dauw jeroended...@gmail.com
Gerrit-Reviewer: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de
Gerrit-Reviewer: jenkins-bot 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Use getStatements instead of getClaims in EntityContent subc... - change (mediawiki...Wikibase)

2015-07-05 Thread Bene (Code Review)
Bene has uploaded a new change for review.

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

Change subject: Use getStatements instead of getClaims in EntityContent 
subclasses
..

Use getStatements instead of getClaims in EntityContent subclasses

Change-Id: I0709f49dd46714286b2bc2fc558facc498615701
---
M repo/includes/content/EntityContent.php
M repo/includes/content/ItemContent.php
M repo/includes/content/PropertyContent.php
3 files changed, 22 insertions(+), 5 deletions(-)


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

diff --git a/repo/includes/content/EntityContent.php 
b/repo/includes/content/EntityContent.php
index 3577335..9c85b81 100644
--- a/repo/includes/content/EntityContent.php
+++ b/repo/includes/content/EntityContent.php
@@ -742,7 +742,6 @@
 *
 * Keys used:
 * - wb-status: the entity's status, according to getEntityStatus()
-* - wb-claims: the number of claims in the entity
 *
 * @return array A map from property names to property values.
 */
@@ -751,9 +750,7 @@
return array();
}
 
-   $properties = array(
-   'wb-claims' = count( $this-getEntity()-getClaims() ),
-   );
+   $properties = array();
 
$status = $this-getEntityStatus();
 
diff --git a/repo/includes/content/ItemContent.php 
b/repo/includes/content/ItemContent.php
index ee013da..4423669 100644
--- a/repo/includes/content/ItemContent.php
+++ b/repo/includes/content/ItemContent.php
@@ -209,7 +209,8 @@
/**
 * @see EntityContent::getEntityPageProperties
 *
-* Records the number of sitelinks in the 'wb-sitelinks' key.
+* Records the number of statements in the 'wb-claims' key
+* and sitelinks in the 'wb-sitelinks' key.
 *
 * @return array A map from property names to property values.
 */
@@ -219,6 +220,7 @@
}
 
$properties = parent::getEntityPageProperties();
+   $properties['wb-claims'] = 
$this-getItem()-getStatements()-count();
$properties['wb-sitelinks'] = 
$this-getItem()-getSiteLinkList()-count();
 
return $properties;
diff --git a/repo/includes/content/PropertyContent.php 
b/repo/includes/content/PropertyContent.php
index b8b40d0..c8f7c51 100644
--- a/repo/includes/content/PropertyContent.php
+++ b/repo/includes/content/PropertyContent.php
@@ -92,6 +92,24 @@
}
 
/**
+* @see EntityContent::getEntityPageProperties
+*
+* Records the number of statements in the 'wb-claims' key.
+*
+* @return array A map from property names to property values.
+*/
+   public function getEntityPageProperties() {
+   if ( $this-isRedirect() ) {
+   return array();
+   }
+
+   $properties = parent::getEntityPageProperties();
+   $properties['wb-claims'] = 
$this-getProperty()-getStatements()-count();
+
+   return $properties;
+   }
+
+   /**
 * Checks if this PropertyContent is valid for saving.
 *
 * Returns false if the entity does not have a DataType set.

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0709f49dd46714286b2bc2fc558facc498615701
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Bene benestar.wikime...@gmail.com

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits