http://www.mediawiki.org/wiki/Special:Code/MediaWiki/90544
Revision: 90544 Author: jeroendedauw Date: 2011-06-21 20:30:34 +0000 (Tue, 21 Jun 2011) Log Message: ----------- renamed and deprecated for 1.6 Modified Paths: -------------- trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Record.php Modified: trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Record.php =================================================================== --- trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Record.php 2011-06-21 20:15:24 UTC (rev 90543) +++ trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Record.php 2011-06-21 20:30:34 UTC (rev 90544) @@ -187,27 +187,43 @@ ////// Additional API for value lists /** + * @deprecated as of 1.0, use getDataItems instead + * + * @return array of SMWDataItem + */ + public function getDVs() { + return $this->getDataItems(); + } + + /** * Create a list (array with numeric keys) containing the datavalue * objects that this SMWRecordValue object holds. Values that are not * present are set to null. Note that the first index in the array is * 0, not 1. * - * @todo This method should be renamed to getDataItems(). + * @since 1.6 + * * @return array of SMWDataItem */ - public function getDVs() { - if ( !$this->isValid() ) return array(); - $result = array(); - $semanticData = $this->m_dataitem->getSemanticData(); - foreach ( $semanticData->getProperties() as $prop ) { - $propname = $prop->getPropertyID(); - $propnum = substr( $propname, 1 ); - if ( ( $propname != false ) && ( is_numeric( $propnum ) ) ) { - $propertyvalues = $semanticData->getPropertyValues( $prop ); // combining this with next line violates PHP strict standards - $result[( $propnum - 1 )] = reset( $propertyvalues ); - } + public function getDataItems() { + $dataItems = array(); + + if ( $this->isValid() ) { + $semanticData = $this->m_dataitem->getSemanticData(); + + foreach ( $semanticData->getProperties() as $prop ) { + $propname = $prop->getPropertyID(); + $propnum = substr( $propname, 1 ); + + if ( ( $propname != false ) && ( is_numeric( $propnum ) ) ) { + // Combining this with next line violates PHP strict standards. + $propertyvalues = $semanticData->getPropertyValues( $prop ); + $result[( $propnum - 1 )] = reset( $propertyvalues ); + } + } } - return $result; + + return $dataItems; } /** _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs