Bläddra i källkod

Added a comment to explain why the APIs AddCondition_PointingTo and AddCondition_ReferencedBy must be left unprotected (do not clone the passed filter). See trac #639

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@2509 a333f486-631f-4898-b8df-5754b55c2be0
romainq 12 år sedan
förälder
incheckning
0549edf93a
1 ändrade filer med 10 tillägg och 3 borttagningar
  1. 10 3
      core/dbobjectsearch.class.php

+ 10 - 3
core/dbobjectsearch.class.php

@@ -668,8 +668,10 @@ class DBObjectSearch
 	{
 		// Note: though it seems to be a good practice to clone the given source filter
 		//       (as it was done and fixed an issue in MergeWith())
-		//       this was not implemented here because it was causing a regression (login as admin, select an org, click on any badge) 
-		// buggy: $oFilter = $oFilter->DeepClone();
+		//       this was not implemented here because it was causing a regression (login as admin, select an org, click on any badge)
+		//       root cause: FromOQL relies on the fact that the passed filter can be modified later 
+		// NO: $oFilter = $oFilter->DeepClone();
+		// See also: Trac #639, and self::AddCondition_ReferencedBy()
 		$aAliasTranslation = array();
 		$res = $this->AddCondition_PointingTo_InNameSpace($oFilter, $sExtKeyAttCode, $this->m_aClasses, $aAliasTranslation, $iOperatorCode);
 		$this->TransferConditionExpression($oFilter, $aAliasTranslation);
@@ -701,7 +703,12 @@ class DBObjectSearch
 
 	public function AddCondition_ReferencedBy(DBObjectSearch $oFilter, $sForeignExtKeyAttCode)
 	{
-		//$oFilter = $oFilter->DeepClone();
+		// Note: though it seems to be a good practice to clone the given source filter
+		//       (as it was done and fixed an issue in MergeWith())
+		//       this was not implemented here because it was causing a regression (login as admin, select an org, click on any badge)
+		//       root cause: FromOQL relies on the fact that the passed filter can be modified later 
+		// NO: $oFilter = $oFilter->DeepClone();
+		// See also: Trac #639, and self::AddCondition_PointingTo()
 		$aAliasTranslation = array();
 		$res = $this->AddCondition_ReferencedBy_InNameSpace($oFilter, $sForeignExtKeyAttCode, $this->m_aClasses, $aAliasTranslation);
 		$this->TransferConditionExpression($oFilter, $aAliasTranslation);