示例#1
0
 /**
  * saveCustomer
  * Save the owner of the domain when we download the information using the Soap service
  * @param $domaininfo
  * @param $owner
  * @return [boolean, Doctrine_Record]
  */
 public static function saveCustomer($domaininfo, $owner)
 {
     // Check the existence of the record
     $arrCustomer = CustomersDomainsRegistrars::getAllInfo($domaininfo['nichandle'], "customer_id as customerid");
     if (!empty($arrCustomer) && count($arrCustomer) > 0) {
         $customer = Doctrine::getTable('Customers')->find($arrCustomer['customerid']);
     } else {
         $customer = new Customers();
     }
     // Add the Customer
     $customer->firstname = $owner['firstname'];
     $customer->lastname = $owner['lastname'];
     $customer->email = $owner['email'];
     $customer->vat = $owner['vat'];
     $customer->company = $owner['organisation'];
     $customer->legalform_id = !empty($owner['legalform']) ? Legalforms::getIDbyName($owner['legalform']) : null;
     $customer->getLast()->toArray();
     if ($customer->trySave()) {
         return $customer;
     } else {
         return false;
     }
 }