Forráskód Böngészése

Internal: DBSearch::Intersect to throw an exception whenever any of the merged queries have a queried class that does not correspond to the first joined class. This is a limitation of the current implementation of Intersect. Allowing such use cases would require quite a rework of that API.

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@4227 a333f486-631f-4898-b8df-5754b55c2be0
romainq 9 éve
szülő
commit
99ec255431
1 módosított fájl, 10 hozzáadás és 0 törlés
  1. 10 0
      core/dbobjectsearch.class.php

+ 10 - 0
core/dbobjectsearch.class.php

@@ -630,6 +630,16 @@ class DBObjectSearch extends DBSearch
 		$aSearches = array();
 		foreach ($aFilters as $oRightFilter)
 		{
+			// Limitation: the queried class must be the first declared class
+			if ($this->GetFirstJoinedClassAlias() != $this->GetClassAlias())
+			{
+				throw new CoreException("Limitation: cannot merge two queries if the queried class ({$this->GetClass()} AS {$this->GetClassAlias()}) is not the first joined class ({$this->GetFirstJoinedClass()} AS {$this->GetFirstJoinedClassAlias()})");
+			}
+			if ($oRightFilter->GetFirstJoinedClassAlias() != $oRightFilter->GetClassAlias())
+			{
+				throw new CoreException("Limitation: cannot merge two queries if the queried class ({$oRightFilter->GetClass()} AS {$oRightFilter->GetClassAlias()}) is not the first joined class ({$oRightFilter->GetFirstJoinedClass()} AS {$oRightFilter->GetFirstJoinedClassAlias()})");
+			}
+
 			$oLeftFilter = $this->DeepClone();
 			$oRightFilter = $oRightFilter->DeepClone();