error_log(sprintf('Found duplicates for "%s": %d', $objSuggestion->SuggestionValue, count($arrDuplicateSuggestions)));
         foreach ($arrDuplicateSuggestions as $objDuplicateSuggestion) {
             if ($objSuggestion->SuggestionValue !== $objDuplicateSuggestion->SuggestionValue) {
                 continue;
             }
             foreach (NarroSuggestionComment::LoadArrayBySuggestionId($objDuplicateSuggestion->SuggestionId) as $objSuggestionComment) {
                 error_log('Moving suggestion comment');
                 $objSuggestionComment->SuggestionId = $objSuggestion->SuggestionId;
                 $objSuggestionComment->Save();
             }
             foreach (NarroSuggestionVote::LoadArrayBySuggestionId($objDuplicateSuggestion->SuggestionId) as $objSuggestionVote) {
                 error_log('Moving suggestion vote');
                 $objSuggestionVote->SuggestionId = $objSuggestion->SuggestionId;
                 $objSuggestionVote->Save();
             }
             foreach (NarroContextInfo::LoadArrayByValidSuggestionId($objDuplicateSuggestion->SuggestionId) as $objApprovedSuggestion) {
                 error_log('Moving approved suggestion');
                 $objApprovedSuggestion->ValidSuggestionId = $objSuggestion->SuggestionId;
                 $objApprovedSuggestion->Save();
             }
             error_log(sprintf('Deleting suggestion %d %d "%s"', $objDuplicateSuggestion->SuggestionId, $objDuplicateSuggestion->LanguageId, $objDuplicateSuggestion->SuggestionValue));
             $objDuplicateSuggestion->Delete();
             $intDuplicateSuggestionsDeleted++;
         }
     }
     $objSuggestion->TextId = $objText->TextId;
     $objSuggestion->Save();
 }
 foreach (NarroContext::LoadArrayByTextId($objDuplicateText->TextId) as $objContext) {
     error_log('Moving text from context');
     $objContext->TextId = $objText->TextId;
示例#2
0
 /**
  * Gets all associated NarroContextInfosAsValidSuggestion as an array of NarroContextInfo objects
  * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
  * @return NarroContextInfo[]
  */
 public function GetNarroContextInfoAsValidSuggestionArray($objOptionalClauses = null)
 {
     if (is_null($this->intSuggestionId)) {
         return array();
     }
     try {
         return NarroContextInfo::LoadArrayByValidSuggestionId($this->intSuggestionId, $objOptionalClauses);
     } catch (QCallerException $objExc) {
         $objExc->IncrementOffset();
         throw $objExc;
     }
 }