Example #1
0
 /**
  * Create a set in-memory with several classes of objects per row (with one alias per "column")
  * 
  * Limitation:
  * The filter/OQL query representing such a set can not be rebuilt (only the first column will be taken into account)
  * 
  * @param hash $aClasses Format: array of (alias => class)
  * @param hash $aObjects Format: array of (array of (classalias => object))
  * 
  * @return DBObjectSet
  */
 public static function FromArrayAssoc($aClasses, $aObjects)
 {
     // In a perfect world, we should create a complete tree of DBObjectSearch,
     // but as we lack most of the information related to the objects,
     // let's create one search definition corresponding only to the first column
     $sClass = reset($aClasses);
     $sAlias = key($aClasses);
     $oFilter = new DBObjectSearch($sClass, $sAlias);
     $oRetSet = new self($oFilter);
     $oRetSet->m_bLoaded = true;
     // no DB load
     $oRetSet->m_iNumTotalDBRows = 0;
     // Nothing from the DB
     foreach ($aObjects as $rowIndex => $aObjectsByClassAlias) {
         $oRetSet->AddObjectExtended($aObjectsByClassAlias);
     }
     return $oRetSet;
 }