DBSearch : Allow join between DBUnionSearch by adding the DBUnionSearch::Join verb

SVN:trunk[3952]
This commit is contained in:
Guillaume Lajarige
2016-03-16 16:45:39 +00:00
parent 92d9c778e5
commit 4b7fb20eaf
3 changed files with 80 additions and 5 deletions

View File

@@ -368,6 +368,31 @@ class DBUnionSearch extends DBSearch
return $sRet;
}
/**
* Returns a new DBUnionSearch object where duplicates queries have been removed based on their OQLs
*
* @return \DBUnionSearch
*/
public function RemoveDuplicateQueries()
{
$aQueries = array();
$aSearches = array();
foreach ($this->GetSearches() as $oTmpSearch)
{
$sQuery = $oTmpSearch->ToOQL(true);
if (!in_array($sQuery, $aQueries))
{
$aQueries[] = $sQuery;
$aSearches[] = $oTmpSearch;
}
}
$oNewSearch = new DBUnionSearch($aSearches);
return $oNewSearch;
}
////////////////////////////////////////////////////////////////////////////
//
// Construction of the SQL queries