/** * * Updates the current record at the database, making calls to pre- and * post-update logic. * * @return void * */ protected function _update() { // pre-update logic $this->_preUpdate(); // modify special columns for update $this->_modUpdate(); // apply record filters $this->filter(); // get the data for update $data = $this->_getUpdateData(); // it's possible we have no data to update, even after all that if (!$data) { $this->_setSqlStatus(self::SQL_STATUS_UNCHANGED); return; } // build the where clause $primary = $this->getPrimaryCol(); $where = array("{$primary} = ?" => $this->getPrimaryVal()); // try the update try { $this->_model->update($data, $where); } catch (Solar_Sql_Adapter_Exception_QueryFailed $e) { // failed at at the database for some reason $this->setInvalid('*', $e->getInfo('pdo_text')); throw $e; } // record was successfully updated $this->_setSqlStatus(self::SQL_STATUS_UPDATED); // post-update logic $this->_postUpdate(); }