示例#1
0
 /**
  * Saves this SummerApplication object
  */
 public function save()
 {
     $is_new = $this->getId() == 0 ? true : false;
     # Save the core application data using the parent class
     if (!parent::save()) {
         return false;
     }
     # Save the application-specific data
     $db = new PHPWS_DB('hms_summer_application');
     /* If this is a new object, call saveObject with the third parameter as 'false' so
      * the database class will insert the object with the ID set by the parent::save() call.
      * Otherwise, call save object as normal so that the database class will detect the ID and
      * update the object.
      */
     if ($is_new) {
         $result = $db->saveObject($this, false, false);
     } else {
         $result = $db->saveObject($this);
     }
     if (PHPWS_Error::logIfError($result)) {
         throw new DatabaseException($result->toString());
     }
     return true;
 }