$exponent = $word; print "created concept.\n"; } $definitionIdToConceptIdMap[$definitionId] = $conceptId; $cdm = ConceptDefinitionMap::create($conceptId, $definitionId); $cdm->save(); } mysql_free_result($dbResult); // Go through all the words having Priority > 0 $dbResult = mysql_query("select * from Word where Priority > 0"); $numRows = mysql_num_rows($dbResult); $i = 0; while ($dbRow = mysql_fetch_assoc($dbResult)) { $i++; $word = new Word(); $word->populateFromDbRow($dbRow); $definitionId = $word->conceptId; // We changed the column name already $conceptId = $definitionIdToConceptIdMap[$definitionId]; $wordsMap = $conceptIdToWordsMap[$conceptId]; print "{$i}/{$numRows} " . $word->name . "... "; // Check if this term was already added if (array_key_exists($word->name, $wordsMap)) { $obsoletedByWordId = $wordsMap[$word->name]; migrateDeclensionModels($word->id, $obsoletedByWordId); $word->delete(); print "deleted.\n"; } else { $word->priority = count($wordsMap); $word->conceptId = $conceptId; $word->save();