/**
  * Given an array of mapping data and an import rules type, make an array of mapping rule forms
  * and element types.  This is indexed by the column name from the mapping data.  If the type of column
  * is 'extraColumn', then the mapping rules forms will be set with the scenario 'extraColumn'.
  * @param array $mappingData
  * @param string $importRulesType
  */
 public static function makeFormsAndElementTypesByMappingDataAndImportRulesType($mappingData, $importRulesType)
 {
     assert('is_array($mappingData)');
     assert('is_string($importRulesType)');
     $mappingRuleFormsAndElementTypes = array();
     foreach ($mappingData as $columnName => $mappingDataByColumn) {
         $mappingRuleFormsAndElementTypes[$columnName] = array();
         assert('$mappingDataByColumn["type"] == "importColumn" || $mappingDataByColumn["type"] == "extraColumn"');
         if ($mappingDataByColumn['attributeIndexOrDerivedType'] != null) {
             $attributeImportRulesClassName = AttributeImportRulesFactory::getClassNameByImportRulesTypeAndAttributeIndexOrDerivedType($importRulesType, $mappingDataByColumn['attributeIndexOrDerivedType']);
             foreach ($mappingDataByColumn["mappingRulesData"] as $mappingRuleFormClassName => $mappingRuleFormData) {
                 $mappingRuleFormAndElementTypes = $attributeImportRulesClassName::getModelAttributeMappingRuleFormTypesAndElementTypes($mappingDataByColumn["type"]);
                 $elementType = $mappingRuleFormAndElementTypes[$mappingRuleFormClassName::getType()];
                 $mappingRuleForm = static::makeForm($importRulesType, $mappingDataByColumn['attributeIndexOrDerivedType'], $mappingRuleFormClassName);
                 if ($mappingDataByColumn['type'] == "extraColumn") {
                     $mappingRuleForm->setScenario('extraColumn');
                 }
                 $mappingRuleForm->setAttributes($mappingRuleFormData);
                 $mappingRuleFormsAndElementTypes[$columnName][] = array('mappingRuleForm' => $mappingRuleForm, 'elementType' => $elementType);
             }
         }
     }
     return $mappingRuleFormsAndElementTypes;
 }