protected function _getD(\Model_ServiceDomain $model) { $orderService = $this->di['mod_service']('order'); $order = $orderService->getServiceOrder($model); $tldRegistrar = $this->di['db']->load('TldRegistrar', $model->tld_registrar_id); if ($order instanceof \Model_ClientOrder) { $adapter = $this->registrarGetRegistrarAdapter($tldRegistrar, $order); } else { $adapter = $this->registrarGetRegistrarAdapter($tldRegistrar); } $d = new \Registrar_Domain(); $d->setLocked($model->locked); $d->setNs1($model->ns1); $d->setNs2($model->ns2); $d->setNs3($model->ns3); $d->setNs4($model->ns4); //merge info with current profile $client = $this->di['db']->load('Client', $model->client_id); $email = empty($model->contact_email) ? $client->email : $model->contact_email; $first_name = empty($model->contact_first_name) ? $client->first_name : $model->contact_first_name; $last_name = empty($model->contact_last_name) ? $client->last_name : $model->contact_last_name; $city = empty($model->contact_city) ? $client->city : $model->contact_city; $zip = empty($model->contact_postcode) ? $client->postcode : $model->contact_postcode; $country = empty($model->contact_country) ? $client->country : $model->contact_country; $state = empty($model->contact_state) ? $client->state : $model->contact_state; $phone = empty($model->contact_phone) ? $client->phone : $model->contact_phone; $phone_cc = empty($model->contact_phone_cc) ? $client->phone_cc : $model->contact_phone_cc; $company = empty($model->contact_company) ? $client->company : $model->contact_company; $address1 = empty($model->contact_address1) ? $client->address_1 : $model->contact_address1; $address2 = empty($model->contact_address2) ? $client->address_2 : $model->contact_address2; $birthday = !empty($client->birthday) ? $client->birthday : ''; $company_number = !empty($client->company_number) ? $client->company_number : ''; $contact = new \Registrar_Domain_Contact(); $contact->setEmail($email)->setUsername($email)->setPassword($this->di['tools']->generatePassword(10, 3))->setFirstname($first_name)->setLastname($last_name)->setCity($city)->setZip($zip)->setCountry($country)->setState($state)->setTel($phone)->setTelCC($phone_cc)->setCompany($company)->setCompanyNumber($company_number)->setAddress1($address1)->setAddress2($address2)->setFax($phone)->setFaxCC($phone_cc)->setBirthday($birthday); $d->setContactRegistrar($contact); $d->setContactAdmin($contact); $d->setContactTech($contact); $d->setContactBilling($contact); $d->setTld($model->tld); $d->setSld($model->sld); $d->setRegistrationPeriod($model->period); $d->setEpp($model->transfer_code); if ($model->expires_at) { $d->setExpirationTime(strtotime($model->expires_at)); } return array($d, $adapter); }