r23780 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23779‎ | r23780 | r23781 >
Date:08:48, 6 July 2007
Author:proes
Status:old
Tags:
Comment:
Addressed FIXMEs in OmegaWikiRecordSets.php
Modified paths:
  • /trunk/extensions/Wikidata/OmegaWiki/OmegaWikiRecordSets.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Wikidata/OmegaWiki/OmegaWikiRecordSets.php
@@ -338,12 +338,17 @@
339339
340340 for ($i = 0; $i < $recordSet->getRecordCount(); $i++) {
341341 $record = $recordSet->getRecord($i);
342 - # FIXME - check for empty values
343 - foreach($textAttributes as $textAttribute)
344 - $record->setAttributeValue(
345 - $textAttribute,
346 - @$textReferences[$record->getAttributeValue($textAttribute)]
347 - );
 342+
 343+ foreach($textAttributes as $textAttribute) {
 344+ $textId = $record->getAttributeValue($textAttribute);
 345+
 346+ if (isset($textReferences[$textId]))
 347+ $textValue = $textReferences[$textId];
 348+ else
 349+ $textValue = "";
 350+
 351+ $record->setAttributeValue($textAttribute, $textValue);
 352+ }
348353 }
349354 }
350355
@@ -750,8 +755,7 @@
751756 if (count($objectIds) > 0) {
752757 for ($i = 0; $i < count($objectIds); $i++) {
753758 $record = new ArrayRecord($objectAttributesRecordStructure);
754 - #FIXME- check value
755 - @$objectAttributesRecords[$objectIds[$i]] = $record;
 759+ $objectAttributesRecords[$objectIds[$i]] = $record;
756760 }
757761
758762 // Text attributes
@@ -799,29 +803,28 @@
800804 $record = $recordSet->getRecord($i);
801805 $objectId = $record->getAttributeValue($objectIdAttribute);
802806
803 - // FIXME: Do some checks whether these values actually exist
804807 // Text attributes
805 - @$textAttributeValuesRecordSet = $textAttributeValuesRecordSets[$objectId];
806 -
807 - if ($textAttributeValuesRecordSet == null)
 808+ if (isset($textAttributeValuesRecordSets[$objectId]))
 809+ $textAttributeValuesRecordSet = $textAttributeValuesRecordSets[$objectId];
 810+ else
808811 $textAttributeValuesRecordSet = $emptyTextAttributesRecordSet;
809812
810813 // Translated text attributes
811 - @$translatedTextAttributeValuesRecordSet = $translatedTextAttributeValuesRecordSets[$objectId];
812 -
813 - if ($translatedTextAttributeValuesRecordSet == null)
 814+ if (isset($translatedTextAttributeValuesRecordSets[$objectId]))
 815+ $translatedTextAttributeValuesRecordSet = $translatedTextAttributeValuesRecordSets[$objectId];
 816+ else
814817 $translatedTextAttributeValuesRecordSet = $emptyTranslatedTextAttributesRecordSet;
815818
816819 // URL attributes
817 - @$urlAttributeValuesRecordSet = $urlAttributeValuesRecordSets[$objectId];
818 -
819 - if ($urlAttributeValuesRecordSet == null)
 820+ if (isset($urlAttributeValuesRecordSets[$objectId]))
 821+ $urlAttributeValuesRecordSet = $urlAttributeValuesRecordSets[$objectId];
 822+ else
820823 $urlAttributeValuesRecordSet = $emptyURLAttributesRecordSet;
821824
822825 // Option attributes
823 - @$optionAttributeValuesRecordSet = $optionAttributeValuesRecordSets[$objectId];
824 -
825 - if ($optionAttributeValuesRecordSet == null)
 826+ if (isset($optionAttributeValuesRecordSets[$objectId]))
 827+ $optionAttributeValuesRecordSet = $optionAttributeValuesRecordSets[$objectId];
 828+ else
826829 $optionAttributeValuesRecordSet = $emptyOptionAttributesRecordSet;
827830
828831 $objectAttributesRecord = new ArrayRecord($objectAttributesRecordStructure);

Status & tagging log