示例#1
0
 /**
  * Save the domain information
  * 
  * @param integer|null $id
  * @param array $params
  * @return Ambigous <unknown, number, NULL, mixed>
  */
 public static function saveAll($id, $params)
 {
     if (is_numeric($id)) {
         $domains = Doctrine::getTable('Domains')->find($id);
     } else {
         $domains = new Domains();
     }
     // Get the TLD information
     $tldInfo = DomainsTlds::getAllInfo($params['tld_id']);
     $params['creation_date'] = empty($params['creation_date']) ? date('Y-m-d') : Shineisp_Commons_Utilities::formatDateIn($params['creation_date']);
     // Set the new values
     $domains->domain = $params['domain'];
     if (isset($tldInfo['WhoisServers'])) {
         $domains->tld = $tldInfo['WhoisServers']['tld'];
     }
     $domains->tld_id = $params['tld_id'];
     $domains->authinfocode = $params['authinfocode'];
     $domains->creation_date = $params['creation_date'];
     $domains->modification_date = date('Y-m-d');
     if (!empty($params['expiring_date'])) {
         $domains->expiring_date = Shineisp_Commons_Utilities::formatDateIn($params['expiring_date']);
     }
     $domains->customer_id = $params['customer_id'];
     $domains->note = $params['note'];
     $domains->registrars_id = !empty($params['registrars_id']) ? $params['registrars_id'] : Null;
     $domains->status_id = $params['status_id'] ? $params['status_id'] : null;
     // Save the data
     if ($domains->trySave()) {
         $id = is_numeric($id) ? $id : $domains->getIncremented();
         return $id;
     }
     return false;
 }