Beispiel #1
0
 /**
  * Merge results of multiple subreports. Set of sub reports result is given.
  * When merging this method uses join conditions defined in report definition, 
  * @param string[][] $resultsSetArray
  * @param ReportDefinition $reportDefinitionObject
  * @return string[]
  * @throws ReportException
  */
 private function mergeWithMultipleJoins($resultsSetArray, $reportDefinitionObject)
 {
     $result = array();
     $reportDefinitionObject->resetJoin();
     $join = $reportDefinitionObject->getCurrentJoin();
     if (is_null($join) || empty($join)) {
         throw new ReportException("Invalid XML Definition!!! \n                    ( The report should contain at least one join element, \n                    if there are more than one sub reports defined )");
     }
     $foundAJoinWithoutAsAttribute = false;
     $numOfJoins = $reportDefinitionObject->getJoinCount();
     for ($i = 0; $i < $numOfJoins; $i++) {
         $joinAs = $reportDefinitionObject->getJoinAs($join);
         if ($foundAJoinWithoutAsAttribute) {
             throw new ReportException("Invalid 'join' definition! refer to ReadMe file..");
         }
         if ($joinAs == "") {
             $foundAJoinWithoutAsAttribute = true;
         }
         $result = $this->mergeResultsUsingJoinBy($resultsSetArray, $reportDefinitionObject, $join);
         $resultsSetArray[$joinAs] = $result;
         $join = $reportDefinitionObject->getNextJoin();
     }
     $reportDefinitionObject->resetJoin();
     return $result;
 }