Ver código fonte

Fixed a regression due to the optimization of the memory usage of DBObjectSet [3142]

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@3154 a333f486-631f-4898-b8df-5754b55c2be0
romainq 11 anos atrás
pai
commit
07e22cc92a
1 arquivos alterados com 13 adições e 0 exclusões
  1. 13 0
      core/dbobjectset.class.php

+ 13 - 0
core/dbobjectset.class.php

@@ -101,6 +101,18 @@ class DBObjectSet
 		return $sRet;
 	}
 
+	public function __clone()
+	{
+		$this->m_oFilter = $this->m_oFilter->DeepClone();
+
+		$this->m_iNumTotalDBRows = null; // Total number of rows for the query without LIMIT. null if unknown yet
+		$this->m_iNumLoadedDBRows = 0; // Total number of rows LOADED in $this->m_oSQLResult via a SQL query. 0 by default
+		$this->m_bLoaded = false; // true when the filter has been used OR the set is built step by step (AddObject...)
+		$this->m_iCurrRow = 0;
+		$this->m_oSQLResult = null;
+	}
+
+
 	/**
 	 * Specify the subset of attributes to load (for each class of objects) before performing the SQL query for retrieving the rows from the DB
 	 * 
@@ -502,6 +514,7 @@ class DBObjectSet
 		{
 			// Free previous resultset if any
 			$this->m_oSQLResult->free();
+			$this->m_oSQLResult = null;
 		}
 		$this->m_iNumTotalDBRows = null;