protected function joinSourceConfigurations(JoinController_SourceConfiguration $sourceConfigurationA, JoinController_SourceConfiguration $sourceConfigurationB) {
        // preparing data from source A
        $adjustedDataA = isset($sourceConfigurationA->data) ? $sourceConfigurationA->adjustDataColumnNames() : NULL;

        // preparing data from source B
        if (isset($sourceConfigurationB->data)) {
            $adjustedDataB = $sourceConfigurationB->adjustDataColumnNames();
            if (isset($adjustedDataA)) {
                $result = NULL;
                // crossing records
                foreach ($adjustedDataA as $recordA) {
                    foreach ($adjustedDataB as $recordB) {
                        $result[] = array_merge($recordA, $recordB);
                    }
                }
            }
            else {
                $result = $adjustedDataB;
            }
        }
        else {
            $result = $adjustedDataA;
        }

        return new JoinController_SourceConfiguration($result);
    }
Esempio n. 2
0
 protected function joinSourceConfigurations(JoinController_SourceConfiguration $sourceConfigurationA, JoinController_SourceConfiguration $sourceConfigurationB)
 {
     // adding data from source A
     $result = isset($sourceConfigurationA->data) ? $sourceConfigurationA->adjustDataColumnNames() : NULL;
     // adding data from source B
     if (isset($sourceConfigurationB->data)) {
         $adjustedDataB = $sourceConfigurationB->adjustDataColumnNames();
         if (isset($result)) {
             $result = array_merge($result, $adjustedDataB);
         } else {
             $result = $adjustedDataB;
         }
     }
     return new JoinController_SourceConfiguration($result);
 }
 public static function getAdjustedSourceConfiguration(JoinController_SourceConfiguration $sourceConfiguration) {
     return new JoinController_SourceConfiguration($sourceConfiguration->adjustDataColumnNames(), $sourceConfiguration->keyColumnNames);
 }