r111268 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111267‎ | r111268 | r111269 >
Date:22:22, 11 February 2012
Author:mkroetzsch
Status:deferred
Tags:
Comment:
improved solution for finding the correct datavalue for record fields (Bug 30284)
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/storage/SMW_ResultArray.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_ResultArray.php
@@ -128,8 +128,22 @@
129129 return false;
130130 }
131131 if ( $this->mPrintRequest->getMode() == SMWPrintRequest::PRINT_PROP &&
132 - ( $this->mPrintRequest->getTypeID() != '_rec' ||
133 - $this->mPrintRequest->getParameter( 'index' ) === false ) ) {
 132+ $this->mPrintRequest->getTypeID() == '_rec' &&
 133+ $this->mPrintRequest->getParameter( 'index' ) !== false ) {
 134+ // Not efficient, but correct: we need to find the right property for
 135+ // the selected index of the record here.
 136+ $pos = $this->mPrintRequest->getParameter( 'index' ) - 1;
 137+ $recordValue = SMWDataValueFactory::newDataItemValue( $di,
 138+ $this->mPrintRequest->getData()->getDataItem() );
 139+ $diProperties = $recordValue->getPropertyDataItems();
 140+
 141+ if ( array_key_exists( $pos, $diProperties ) &&
 142+ !is_null( $diProperties[$pos] ) ) {
 143+ $diProperty = $diProperties[$pos];
 144+ } else {
 145+ $diProperty = null;
 146+ }
 147+ } elseif ( $this->mPrintRequest->getMode() == SMWPrintRequest::PRINT_PROP ) {
134148 $diProperty = $this->mPrintRequest->getData()->getDataItem();
135149 } else {
136150 $diProperty = null;

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r111267fixed Bug 30284mkroetzsch22:04, 11 February 2012