/** * @return JsonModel * @throws \Exception */ public function customFieldsAction() { $user = $this->zfcUserAuthentication()->getIdentity(); if (UserHelper::isMerchant($user)) { $customFields = $this->getServiceLocator()->get('customerService')->getCustomFields($user->getAccount()); return new JsonModel(CustomFieldFacade::formatCustomFieldCollection($customFields)); } }
/** * @param $post */ public function fillFromPost($post, $customFields = null) { if ($post->get('firstName') != null) { $this->first_name = $post->get('firstName'); } if ($post->get('lastName') != null) { $this->last_name = $post->get('lastName'); } if ($post->get('cardCode') != null) { $this->card_code = $post->get('cardCode'); } if ($post->get('cardNumber') != null) { $this->card_number = $post->get('cardNumber'); } if ($post->get('phone') != null) { $this->phone = $post->get('phone'); } if ($post->get('email') != null) { $this->email = $post->get('email'); } if ($post->get('address1') != null) { $this->address1 = $post->get('address1'); } if ($post->get('address2') != null) { $this->address2 = $post->get('address2'); } if ($post->get('city') != null) { $this->city = $post->get('city'); } if ($post->get('state') != null) { $this->state = $post->get('state'); } if ($post->get('zip') != null) { $this->zip = $post->get('zip'); } if ($post->get('country') != null) { $this->country = $post->get('country'); } if ($customFields != null) { $count = 0; $this->custom_fields = array(); foreach ($customFields as $customField) { $this->custom_fields[$count] = CustomFieldFacade::formatCustomField($customField); if ($post->get($customField->getFieldName()) != null) { $this->custom_fields[$count]["value"] = $post->get($customField->getFieldName()); } else { $this->custom_fields[$count]["value"] = null; } $count++; } } }