/**
  * loadMultiFieldData
  * @param string $strType
  * @param array $arrTypeProperties
  * @author Thomas Schedler <*****@*****.**>
  * @version 1.0
  */
 protected final function loadMultiFieldData($strType, $arrTypeProperties)
 {
     try {
         /**
          * generic form multi fields
          */
         if (count($this->setup->MultiFields()) > 0) {
             $objGenTable = $this->getModelGenericData()->getGenericTable($strType . '-' . $this->setup->getFormId() . '-' . $this->setup->getFormVersion() . '-InstanceMultiFields');
             $strTableName = $objGenTable->info(Zend_Db_Table_Abstract::NAME);
             $objSelect = $objGenTable->select();
             $objSelect->setIntegrityCheck(false);
             $objSelect->from($objGenTable->info(Zend_Db_Table_Abstract::NAME), array('idRelation', 'value'));
             $objSelect->join('fields', 'fields.id = `' . $objGenTable->info(Zend_Db_Table_Abstract::NAME) . '`.idFields', array('name'));
             $objSelect->where($strType . 'Id = ?', $arrTypeProperties['Id']);
             $objSelect->where('version = ?', $arrTypeProperties['Version']);
             $objSelect->where('idLanguages = ?', $this->Setup()->getLanguageId());
             $arrGenFormsData = $objGenTable->fetchAll($objSelect);
             if (count($arrGenFormsData) > 0) {
                 $this->blnHasLoadedMultiFieldData = true;
                 foreach ($arrGenFormsData as $arrGenRowFormsData) {
                     $arrTmpRelationIds = $this->setup->getMultiField($arrGenRowFormsData->name)->getValue();
                     if (is_array($arrTmpRelationIds)) {
                         array_push($arrTmpRelationIds, $arrGenRowFormsData->idRelation);
                     } else {
                         $arrTmpRelationIds = array($arrGenRowFormsData->idRelation);
                     }
                     $this->setup->getMultiField($arrGenRowFormsData->name)->setValue($arrTmpRelationIds);
                 }
             }
         }
     } catch (Exception $exc) {
         $this->core->logger->err($exc);
     }
 }
 /**
  * updateMultiFieldData
  * @param string $strType, string $strTypeId, integer $intTypeVersion
  * @author Thomas Schedler <*****@*****.**>
  * @version 1.0
  */
 protected final function updateMultiFieldData($strType, $strTypeId, $intTypeVersion)
 {
     if (count($this->setup->MultiFields()) > 0) {
         $objGenTable = $this->getModelGenericData()->getGenericTable($strType . '-' . $this->setup->getFormId() . '-' . $this->setup->getFormVersion() . '-InstanceMultiFields');
         $strWhere = $objGenTable->getAdapter()->quoteInto($strType . 'Id = ?', $strTypeId);
         $strWhere .= $objGenTable->getAdapter()->quoteInto(' AND version = ?', $intTypeVersion);
         $strWhere .= $objGenTable->getAdapter()->quoteInto(' AND idLanguages = ?', $this->setup->getLanguageId());
         $objGenTable->delete($strWhere);
         /**
          * update the file instances table
          */
         foreach ($this->setup->MultiFields() as $strField => $objField) {
             $intFieldId = $objField->id;
             if (is_array($objField->getValue()) && count($objField->getValue()) > 0) {
                 foreach ($objField->getValue() as $intRelationId) {
                     if ($intRelationId != '') {
                         $arrFileData = array($strType . 'id' => $strTypeId, 'version' => $intTypeVersion, 'idLanguages' => $this->setup->getLanguageId(), 'idRelation' => $intRelationId, 'idFields' => $intFieldId);
                         $this->getModelGenericData()->getGenericTable($strType . '-' . $this->setup->getFormId() . '-' . $this->setup->getFormVersion() . '-InstanceMultiFields')->insert($arrFileData);
                     }
                 }
             }
         }
     }
 }