Sfoglia il codice sorgente

#1178 Internals: Object Update/Reload should never fail: as soon as a given object has been read in the current execution context, updating/reloading it is not an issue.

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@4402 a333f486-631f-4898-b8df-5754b55c2be0
romainq 8 anni fa
parent
commit
c0139a35c0
1 ha cambiato i file con 6 aggiunte e 1 eliminazioni
  1. 6 1
      core/dbobject.class.php

+ 6 - 1
core/dbobject.class.php

@@ -192,10 +192,14 @@ abstract class DBObject implements iDisplay
 		return true;
 	}
 
+	/**
+	 * @param bool $bAllowAllData DEPRECATED: the reload must never fail!
+	 * @throws CoreException
+	 */
 	public function Reload($bAllowAllData = false)
 	{
 		assert($this->m_bIsInDB);
-		$aRow = MetaModel::MakeSingleRow(get_class($this), $this->m_iKey, false /* must be found */, $bAllowAllData/* in the future $this->m_bAllowAllData ??*/);
+		$aRow = MetaModel::MakeSingleRow(get_class($this), $this->m_iKey, false /* must be found */, true /* AllowAllData */);
 		if (empty($aRow))
 		{
 			throw new CoreException("Failed to reload object of class '".get_class($this)."', id = ".$this->m_iKey);
@@ -1931,6 +1935,7 @@ abstract class DBObject implements iDisplay
 				{
 					$oFilter = new DBObjectSearch(get_class($this));
 					$oFilter->AddCondition('id', $this->m_iKey, '=');
+					$oFilter->AllowAllData();
 			
 					$sSQL = $oFilter->MakeUpdateQuery($aDBChanges);
 					CMDBSource::Query($sSQL);