function updateDefaults($data, $accountId = '') { if (!$accountId) { $identity = Zend_Auth::getInstance()->getIdentity(); $accountId = $identity->account_id; } $model = new Model_Wep(); //Update default values $dfg = new Model_DefaultFieldValues(); //User existing default values setting. $defaultObj = $dfg->getDefaultObjByOrganisation($accountId); $fieldString = $this->prepareDefaultFieldValues($data, $defaultObj); $defaultValues['id'] = $model->getIdByField('default_field_values', 'account_id', $accountId); $defaultValues['object'] = $fieldString; $defaultValuesId = $model->updateRowsToTable('default_field_values', $defaultValues); //Update Default Fields if (!empty($data['default_fields'])) { $defaultFieldGroupObj = new Iati_WEP_AccountDisplayFieldGroup(); foreach ($data['default_fields'] as $eachField) { print $eachField; $defaultFieldGroupObj->setProperties($eachField); } $fieldString = serialize($defaultFieldGroupObj); $defaultFields['id'] = $model->getIdByField('default_field_groups', 'account_id', $accountId); $defaultFields['object'] = $fieldString; $defaultFieldId = $model->updateRowsToTable('default_field_groups', $defaultFields); } }