public function update($id, $state, $info) { $data = array('state' => $state, 'info' => $info, 'lastupdate' => time()); $found = $this->find($id); if ($found) { $data = array_merge($found, $data); unset($data['id']); $this->dbTable->update($data, array('id = ?' => $id)); } else { $data['id'] = $id; $data['sticked'] = 0; $this->dbTable->insert($data); } }
public function update(array $data, $where) { if (!isset($data['updated_at'])) { $data['updated_at'] = date('Y-m-d H:i:s'); } return parent::update($data, $where); }
public function updateProfile($data, $user_id) { $value['first_name'] = $data['first_name']; $value['middle_name'] = $data['middle_name']; $value['last_name'] = $data['last_name']; return parent::update($value, array('user_id = ?' => $user_id)); }
public function updateStatus($status, $id) { foreach ($status as $key => $val) { $data[$key] = $val; } return parent::update($data, array('user_id = ?' => $id)); }
public function update(array $data, $where) { if (empty($data['updated_at'])) { $data['updated_at'] = new Zend_Db_Expr('NOW()'); } return parent::update($data, $where); }
public function update($data, $where) { parent::update($data, $where); $this->where = $where; $this->data = $data; $this->_notifyObservers("update"); }
public function update(array $data, $where) { $data = $this->filter($data); if (count($data) <= 0) { return false; } return parent::update($data, $where); }
public function changeGroupadminUsername($old_group_identifier, $group_identifier, $user_id) { $old_username = $old_group_identifier . '_group'; $data['user_name'] = $group_identifier . '_group'; parent::update($data, array('user_name = ?' => $old_username)); $userGroupModel = new User_Model_DbTable_UserGroup(); $userGroupModel->updateUsername($group_identifier, $user_id); }
/** * Update DB row with data * * @param mixed $id '' * @param array $data '' * @return void * @throws Zend_Exception if row cannot be updated */ private function _update($id, $data) { try { $stmt = $this->_getWhereStatement($id); $this->obj->update($data, $stmt); } catch (\Zend_Exception $e) { throw $e; } }
public function updates($id, $titulo, $comentario, $noticia, $foto, $data, $fonte, $ativo, $categoria_noticia_id) { try { $data = array('titulo' => $titulo, 'comentario' => $comentario, 'noticia' => $noticia, 'foto' => $foto, 'fonte' => $fonte, 'ativo' => $ativo, 'categoria_noticia_id' => $categoria_noticia_id); parent::update($data, 'id = ' . (int) $id); } catch (Exception $e) { echo 'Opa... algum problema aconteceu.'; } }
public function updates($id, $titulo, $comentario, $entrevista, $foto, $data, $entrevistado, $reporter, $ativo) { try { $dados = array('titulo' => $titulo, 'comentario' => $comentario, 'entrevista' => $entrevista, 'foto' => $foto, 'data' => $data, 'entrevistado' => $entrevistado, 'reporter' => $reporter, 'ativo' => $ativo); parent::update($dados, 'id = ' . (int) $id); } catch (Exception $e) { echo 'Opa... algum problema aconteceu.'; } }
public function update(array $data, $where) { // хешируем пароль if (isset($data['password'])) { $data['salt'] = $salt = self::generateSalt(); $data['password'] = self::getPasswordHash($data['password'], $salt); } return parent::update($data, $where); }
/** * updateNode * @param array $arrUpdateData * @author Thomas Schedler <*****@*****.**> * @version 1.0 */ private function updateNode($arrUpdateData) { try { $strWhere = $this->objTable->getAdapter()->quoteInto('id = ?', $this->intNodeId); $this->objTable->update($arrUpdateData, $strWhere); } catch (Exception $exc) { $this->core->logger->err($exc); } }
public function update(array $data, $where) { $data['updatedDate'] = date("Y-m-d h:i:s"); $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $userName = $auth->getIdentity()->username; $data['updatedBy'] = $userName; } return parent::update($data, $where); }
/** * set application state * * @param array $_applicationIds application ids to set new state for * @param string $_state the new state * @throws Tinebase_Exception_InvalidArgument */ public function setApplicationState(array $_applicationIds, $_state) { if ($_state != Tinebase_Application::DISABLED && $_state != Tinebase_Application::ENABLED) { throw new Tinebase_Exception_InvalidArgument('$_state can be only Tinebase_Application::DISABLED or Tinebase_Application::ENABLED'); } $where = array($this->_db->quoteInto($this->_db->quoteIdentifier('id') . ' IN (?)', $_applicationIds)); $data = array('status' => $_state); $affectedRows = $this->_applicationTable->update($data, $where); $this->_cleanCache(); //error_log("AFFECTED:: $affectedRows"); }
/** * Обновляет строки таблицы. * Все значения '' (пустая строка) в массиве $data заменяются на null. * * @param array $data Массив пар "поле => значение". * * @param array|string $where Условие отбора строк. * Если $where является числом, то будет обновлена строка, * значение первичного ключа которой равно $where. * * @return int Количество обновленных строк. */ public function update(array $data, $where) { if ($keys = array_keys($data, '')) { foreach ($keys as $key) { $data[$key] = null; } } if (is_numeric($where)) { $primary = (array) $this->_primary; $where = reset($primary) . ' = ' . $where; } return parent::update($data, $where); }
public function update(array $data, $where = array()) { $cols = $this->_getCols(); foreach ($cols as $key) { if (!isset($data[$key])) { unset($data[$key]); } } if (isset($data[$this->_primary])) { unset($data['uid']); } if (in_array('updated', $cols) && empty($data['updated'])) { $data['updated'] = date('Y-m-d H:i:s'); } return parent::update($data, $where); }
public function updateColumns(array $data, $columnValuesMap) { if (empty($data['date_last_modified'])) { $data['date_last_modified'] = date("Y-m-d"); } $userdata = Zend_Controller_Action_HelperBroker::getStaticHelper('AclHelper')->getCurrentUser()->toArray(); if (empty($data['user_last_modified'])) { $data['user_last_modified'] = $userdata['username']; } if (is_null($columnValuesMap) && empty($columnValuesMap)) { return; } $whereTemp = array(); foreach ($columnValuesMap as $key => $value) { if (is_int($value)) { $whereTemp[] = $key . "=" . $value; } else { $whereTemp[] = $key . "='" . $value . "'"; } } $where = implode(" AND ", $whereTemp); parent::update($data, $where); }
/** * Override update method to include pre-update hook * * @param mixed $data * @param mixed $where * @return int */ public function update(array $data, $where) { $data = $this->preUpdate($data); return parent::update($data, $where); }
public function update(Next_Model_Abstract $_obj) { $objArray = $_obj->toArray(); $this->dbTable->update($objArray, array('id = ?' => $_obj->getId())); }
public function updateCode($data, $code, $tblName) { $this->_name = $tblName; // $data['lang_id']=$lang; parent::update($data, array('Code = ?' => $code)); }
/** * Overrides update() from Zend_Db_Table_Abstract * * @param mixed $data * @param mixed $where * @access public * @return int */ public function update(array $data, $where) { $data['time_update'] = time(); $data = $this->_filter($data); $where = $this->_normalizeWhere($where); return parent::update($data, $where); }
/** * Updates existing rows. * * @param array $data Column-value pairs. * @param array|string $where An SQL WHERE clause, or an array of SQL WHERE clauses. * @return int The number of rows updated. */ public function update(array $data, $where) { $this->_setAdapter(Zoo::getService('db')->getDb('master')); return parent::update($data, $where); }
/** Update data * @access public * @param array $data * @param array $where * @return \Pas_Db_Table_Caching */ public function update(array $data, $where) { parent::update($data, $where); $this->_purgeCache(); return $this; }
/** * @param array $data * @param String $where * @return int */ public function update(array $data, $where) { if (in_array("time", $this->info(\Zend_Db_Table_Abstract::COLS))) { $data['time'] = new \Zend_Db_Expr("UTC_TIMESTAMP()"); } return parent::update($data, $where); }
/** * Updates existing rows. * * Append the modified time automatically * * @param array $data Column-value pairs. * @param array|string $where An SQL WHERE clause, or an array of SQL WHERE clauses. * @return int The number of rows updated. */ public function update(array $data, $where = array()) { if (count($where) == 0) { throw new Exception(); } $cols = $this->_getCols(); foreach ($data as $k => $v) { if (!in_array($k, $cols)) { unset($data[$k]); } } if (is_string($this->_primary)) { if (isset($data[$this->_primary])) { unset($data[$this->_primary]); } } else { if (is_array($this->_primary)) { foreach ($this->_primary as $v) { if (isset($data[$v])) { unset($data[$v]); } } } } if (count($data) == 0) { return; } if (in_array('updated', $cols) && empty($data['updated'])) { $data['updated'] = date('Y-m-d H:i:s'); } foreach ($where as $k => $v) { $where[$k . ' = ?'] = $v; unset($where[$k]); } //Core_Dao::buildArrayWhere($where); return parent::update($data, $where); }
public function updateById(array $dados, $id) { $primary = is_array($this->_primary) ? $this->_primary[1] : $this->_primary; $where = $this->getDefaultAdapter()->quoteInto($primary . " = ?", $id); return parent::update($dados, $where); }
/** * Overrides the table update statement to set the modified time column automatically. * @param array $data Data to update. * @param string $where WHERE clause to limit the update. * @return int Number of rows updated. */ public function update(array $data, $where) { $data[self::MTIME_COLUMN] = time(); return parent::update($data, $where); }
public function update(array $data, $where) { return parent::update($data, $where); }
/** * Updates existing rows. * * @param array $data Column-value pairs * @param array|string $where An SQL WHERE clause, or an array of SQL WHERE clauses * @return int The number of rows updated */ public function update(array $data, $where) { Centurion_Signal::factory('pre_update')->send($this, array($data, $where)); if (in_array(self::UPDATED_AT_COL, $this->_getCols()) && empty($data[self::UPDATED_AT_COL])) { $data[self::UPDATED_AT_COL] = Zend_Date::now()->toString(Centurion_Date::MYSQL_DATETIME); } $count = parent::update($data, $where); Centurion_Signal::factory('post_update')->send($this, array($data, $where, $count)); return $count; }