当前位置: 首页>>代码示例>>PHP>>正文


PHP BaseModel::update方法代码示例

本文整理汇总了PHP中BaseModel::update方法的典型用法代码示例。如果您正苦于以下问题:PHP BaseModel::update方法的具体用法?PHP BaseModel::update怎么用?PHP BaseModel::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BaseModel的用法示例。


在下文中一共展示了BaseModel::update方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: update

 public function update(array $arData = [], array $options = [])
 {
     if (empty($arData['password'])) {
         unset($arData['password']);
     }
     parent::update($arData);
 }
开发者ID:andrey900,项目名称:slimcms,代码行数:7,代码来源:Users.php

示例2: update

 public function update($pa_options = null)
 {
     $this->_generateSortableValue();
     // populate sort field
     // Invalid entire labels-by-id cache since we can't know what entries pertain to the label we just changed
     LabelableBaseModelWithAttributes::$s_labels_by_id_cache = array();
     // Unset label cache entry for modified label only
     unset(LabelableBaseModelWithAttributes::$s_label_cache[$this->getSubjectTableName()][$this->get($this->getSubjectKey())]);
     return parent::update($pa_options);
 }
开发者ID:guaykuru,项目名称:pawtucket,代码行数:10,代码来源:BaseLabel.php

示例3: update

 function update($values, $id)
 {
     $values = (array) $values;
     foreach ($values['params'] as $id_widget_param => $value) {
         if ($this->widgetParamModel->isExist($id_widget_param)) {
             $this->widgetParamModel->update($value, $id_widget_param);
         } else {
             $this->widgetParamModel->insert(array('id_widget' => $id) + (array) $value);
         }
     }
     unset($values['params']);
     $values['added'] = 1;
     parent::update($values, $id);
 }
开发者ID:oaki,项目名称:demoshop,代码行数:14,代码来源:WidgetModel.php

示例4: update

 public function update($data)
 {
     $this->mapping->fields['status'] = 'messageStatus';
     $this->mapping->criterias['id'] = new stdclass();
     $this->mapping->criterias['id']->field = 'messageID';
     $this->mapping->criterias['id']->operator = '=';
     $this->mapping->criterias['id']->value = $data->id;
     try {
         $this->dbh->beginTransaction();
         parent::update($data);
         $this->dbh->commit();
     } catch (PDOException $exception) {
         $this->dbh->rollback();
         $this->modelException(Text::read('message.model.error.update'), $exception);
     }
 }
开发者ID:sohflp,项目名称:Hooked,代码行数:16,代码来源:class.MessageModel.php

示例5: update

 public function update($data)
 {
     $this->mapping->fields['title'] = 'faqTitle';
     $this->mapping->fields['text'] = 'faqText';
     $this->mapping->fields['user'] = 'updatedBy';
     // Tratamento adicional de dados
     $data->user = $_SESSION['admLogin']->getUserID();
     $this->mapping->criterias['id'] = new stdclass();
     $this->mapping->criterias['id']->field = 'faqID';
     $this->mapping->criterias['id']->operator = '=';
     $this->mapping->criterias['id']->value = $data->id;
     try {
         $this->dbh->beginTransaction();
         parent::update($data);
         $this->dbh->commit();
     } catch (PDOException $exception) {
         $this->dbh->rollback();
         $this->modelException(get_called_class() . "::" . __FUNCTION__, Text::read('message.model.error.update'), $exception);
     }
 }
开发者ID:sohflp,项目名称:Hooked,代码行数:20,代码来源:class.FAQModel.php

示例6: update

 public function update($data)
 {
     // Converte preço para formato do Banco
     $data->price = str_replace(',', '.', $data->price);
     $data->discount = str_replace(',', '.', $data->discount);
     if ($data->name) {
         $this->mapping->fields['name'] = 'productName';
     }
     if ($data->text) {
         $this->mapping->fields['text'] = 'productDescription';
     }
     if ($data->type) {
         $this->mapping->fields['type'] = 'typeID';
     }
     if ($data->subtype) {
         $this->mapping->fields['subtype'] = 'subTypeID';
     }
     if ($data->brand) {
         $this->mapping->fields['brand'] = 'brandID';
     }
     if ($data->price) {
         $this->mapping->fields['price'] = 'productPrice';
     }
     if ($data->discount) {
         $this->mapping->fields['discount'] = 'productDiscount';
     }
     if ($data->status) {
         $this->mapping->fields['status'] = 'productStatus';
     }
     // Tratamento adicional do produto
     //  - Altera status para NOVO quando o produto atualizado estiver reprovado
     if ($data->status == Config::read('product.status')['reproved']) {
         $data->status = Config::read('product.status')['new'];
     }
     $this->mapping->criterias['id'] = new stdclass();
     $this->mapping->criterias['id']->field = 'productID';
     $this->mapping->criterias['id']->operator = '=';
     $this->mapping->criterias['id']->value = $data->id;
     try {
         $this->dbh->beginTransaction();
         parent::update($data);
         $this->dbh->commit();
     } catch (PDOException $exception) {
         $this->dbh->rollback();
         $this->modelException(Text::read('message.model.error.update'), $exception);
     }
 }
开发者ID:sohflp,项目名称:Hooked,代码行数:47,代码来源:class.ProductModel.php

示例7: update

 /**
  * {@inheritDoc}
  * @param string $name
  */
 public function update($name, $value, $type = 'i')
 {
     parent::update($name, $value, $type);
     $this->storeInCache();
 }
开发者ID:kleitz,项目名称:bzion,代码行数:9,代码来源:CachedModel.php

示例8: update

 /**
  * Saves changes to user record. You must make sure all required user fields are set before calling this method. If errors occur you can use the standard Table class error handling methods to figure out what went wrong.
  *
  * Required fields are user_name, password, fname and lname.
  *
  * If you do not call this method at the end of your request changed user vars will not be saved! If you are also using the Auth class, the Auth->close() method will call this for you.
  *
  * @access public
  * @return bool Returns true if no error, false if error occurred
  */
 public function update($pa_options = null)
 {
     $this->clearErrors();
     # set user vars (the set() method automatically serializes the vars array)
     if ($this->opa_user_vars_have_changed) {
         $this->set("vars", $this->opa_user_vars);
     }
     if ($this->opa_volatile_user_vars_have_changed) {
         $this->set("volatile_vars", $this->opa_volatile_user_vars);
     }
     unset(ca_users::$s_user_role_cache[$this->getPrimaryKey()]);
     unset(ca_users::$s_group_role_cache[$this->getPrimaryKey()]);
     return parent::update();
 }
开发者ID:ffarago,项目名称:pawtucket2,代码行数:24,代码来源:ca_users.php

示例9: update

 public function update($pa_options = null)
 {
     $vb_web_set_change_log_unit_id = BaseModel::setChangeLogUnitID();
     if (!is_array($pa_options)) {
         $pa_options = array();
     }
     $pa_options['dont_do_search_indexing'] = true;
     $va_field_values = $this->getFieldValuesArray();
     // get pre-update field values (including attribute values)
     // change status for attributes is only available **before** update
     $va_fields_changed_array = $this->_FIELD_VALUE_CHANGED;
     if (parent::update($pa_options)) {
         $this->_commitAttributes($this->getTransaction());
         //	$va_field_values_with_updated_attributes = $this->addAttributesToFieldValuesArray();	// copy committed attribute values to field values array
         // set the field values array for this instance
         //$this->setFieldValuesArray($va_field_values_with_updated_attributes);
         $this->doSearchIndexing($va_fields_changed_array);
         if ($vb_web_set_change_log_unit_id) {
             BaseModel::unsetChangeLogUnitID();
         }
         if ($this->numErrors() > 0) {
             return false;
         }
         return true;
     }
     if ($vb_web_set_change_log_unit_id) {
         BaseModel::unsetChangeLogUnitID();
     }
     return false;
 }
开发者ID:idiscussforum,项目名称:providence,代码行数:30,代码来源:BaseModelWithAttributes.php

示例10: update

 public function update($data)
 {
     $this->mapping->fields['name'] = 'accountFirstName';
     $this->mapping->fields['surname'] = 'accountLastName';
     $this->mapping->fields['sex'] = 'accountSex';
     $this->mapping->fields['email'] = 'accountEmail';
     $this->mapping->fields['news'] = 'accountNews';
     $this->mapping->fields['cpf'] = 'accountCPF';
     $this->mapping->fields['phone'] = 'accountPhone';
     $this->mapping->fields['cellphone'] = 'accountCellPhone';
     if ($this->addressModel) {
         $this->mapping->fields = array_merge($this->mapping->fields, $this->addressModel->addressMapping());
     }
     // Tratamento adicional de dados
     if ($data->passoword) {
         $this->mapping->fields['password'] = 'accountPassword';
         $data->password = md5($data->password);
     }
     $data->news = (int) $data->news;
     $this->mapping->criterias['id'] = new stdclass();
     $this->mapping->criterias['id']->field = 'accountID';
     $this->mapping->criterias['id']->operator = '=';
     $this->mapping->criterias['id']->value = $data->id;
     try {
         $this->dbh->beginTransaction();
         parent::update($data);
         $this->dbh->commit();
     } catch (PDOException $exception) {
         $this->dbh->rollback();
         $this->modelException(Text::read('message.model.error.update'), $exception);
     }
 }
开发者ID:sohflp,项目名称:Hooked,代码行数:32,代码来源:class.AccountModel.php

示例11: update

 public function update($pa_options = null)
 {
     if (!$this->_preSaveActions()) {
         return false;
     }
     $vn_old_status = $this->getOriginalValue('order_status');
     $vn_old_ship_date = $this->getOriginalValue('shipping_date');
     $vn_old_shipped_on_date = $this->getOriginalValue('shipped_on_date');
     // Move order status automatically to reflect business logic
     switch ($this->get('order_status')) {
         case 'PROCESSED':
             if ($this->get('shipped_on_date') && $this->changed('shipped_on_date') && !$this->requiresDownload()) {
                 // If it shipped and there's nothing left to fulfill by download then ship status to "complete"
                 $this->set('order_status', 'COMPLETED');
             }
             break;
         case 'AWAITING_PAYMENT':
             if ($this->get('payment_received_on') && $this->changed('payment_received_on') || $this->getTotal() == 0) {
                 if ($this->get('order_type') == 'L') {
                     // LOANS
                     $this->set('order_status', 'PROCESSED');
                 } else {
                     // SALES ORDERS
                     // If it paid for then flip status to "PROCESSED" (if it's all ready to go) or "PROCESSED_AWAITING_DIGITIZATION" if stuff needs to be digitized
                     if (sizeof($va_items_with_no_media = $this->itemsWithNoDownloadableMedia()) > 0) {
                         $this->set('order_status', 'PROCESSED_AWAITING_DIGITIZATION');
                     } else {
                         // If "original" files are missing then mark as PROCESSED_AWAITING_MEDIA_ACCESS
                         if (sizeof($va_items_missing_media = $this->itemsMissingDownloadableMedia('original'))) {
                             $this->set('order_status', 'PROCESSED_AWAITING_MEDIA_ACCESS');
                         } else {
                             $this->set('order_status', 'PROCESSED');
                         }
                     }
                 }
             }
             break;
     }
     $vb_status_changed = $this->changed('order_status');
     $this->set('order_number', ca_commerce_orders::generateOrderNumber($this->getPrimaryKey(), $this->get('created_on', array('GET_DIRECT_DATE' => true))));
     if ($vn_rc = parent::update($pa_options)) {
         if ($vb_status_changed) {
             $this->sendStatusChangeEmailNotification($vn_old_status, $vn_old_ship_date, $vn_old_shipped_on_date);
         }
         if (in_array($this->get('order_status'), array('PROCESSED', 'PROCESSED_AWAITING_DIGITIZATION', 'PROCESSED_AWAITING_MEDIA_ACCESS', 'COMPLETED'))) {
             // Delete originating set if configured to do so
             if ($this->opo_client_services_config->get('set_disposal_policy') == 'DELETE_WHEN_ORDER_PROCESSED') {
                 $t_trans = new ca_commerce_transactions($this->get('transaction_id'));
                 if ($t_trans->getPrimaryKey()) {
                     $t_set = new ca_sets($t_trans->get('set_id'));
                     if ($t_set->getPrimaryKey()) {
                         $t_set->setMode(ACCESS_WRITE);
                         $t_set->delete(true);
                     }
                 }
             }
         }
     }
     return $vn_rc;
 }
开发者ID:guaykuru,项目名称:pawtucket,代码行数:60,代码来源:ca_commerce_orders.php

示例12: BaseModel

<?php

$outbox_id = $_REQUEST['outbox_id'];
if (!$outbox_id) {
    exit;
}
require_once 'config.inc.php';
require_once 'BaseModel.class.php';
$db = new BaseModel('recieved');
#  1: delivery success
#  2: delivery failure
#  4: message buffered
#  8: smsc submit
#  16: smsc reject
$status[1] = 'successful';
$status[2] = 'failure';
$status[4] = 'buffered';
$status[8] = 'success';
$status[16] = 'reject';
$type = $_REQUEST['type'];
$type = $status[$type] ? $status[$type] : $type;
$d['status'] = $type;
//$d['modified_date'] = "NOW()";
$db->update('outbox', $d, "id={$outbox_id}");
开发者ID:john-lioneil,项目名称:sams,代码行数:24,代码来源:dlr.php

示例13: update

 public function update($pa_options = null)
 {
     $vm_rc = parent::update($pa_options);
     $this->flushLocaleListCache();
     return $vm_rc;
 }
开发者ID:idiscussforum,项目名称:providence,代码行数:6,代码来源:ca_locales.php

示例14: update

 /**
  * update user's data
  *
  * @param int user id
  * @param array
  * @param bool update identity of logged user?
  * @param bool skip checking ACL? - used internally while logging in
  */
 public function update($id, array $data, $updateIdentity = false, $skipCheckingAcl = false)
 {
     if ($this->config['useAcl'] and !$skipCheckingAcl) {
         // check rights - client can update only users who he created
         if (!$this->user->isAllowed(new UserResource($id), Acl::PRIVILEGE_EDIT)) {
             throw new OperationNotAllowedException();
         }
     }
     // for $nonce in getHasherParamsFromUserData()
     $data['id'] = $id;
     //	if we come from userEdit form
     if (isset($data['password'])) {
         // user did not enter new password
         if (empty($data['password'])) {
             unset($data['password']);
         } else {
             // if current password is required (typically when calling from updateLoggedUser(); admin does not have to enter currentPassword)
             if (isset($data['currentPassword'])) {
                 $dbData = $this->find($this->userId);
                 // check if it's correct
                 if (!$this->hasher->checkPassword($data['currentPassword'], $dbData->password, $this->getHasherParamsFromUserData($data))) {
                     //		    			throw new InvalidPasswordException('Zadali ste nesprávne stávajúce heslo.');
                     throw new InvalidPasswordException('You entered invalid current password. Try again please!');
                 }
             }
             $data['password'] = $this->hasher->hashPassword($data['password'], $this->getHasherParamsFromUserData($data));
         }
         unset($data['currentPassword']);
         unset($data['password2']);
     }
     // update roles
     if (isset($data['roles'])) {
         $this->getRolesModel()->updateUserRoles($id, $data['roles']);
         unset($data['roles']);
     }
     if (isset($data['client_logo'])) {
         $this->saveClientLogo($id, $data['client_logo']);
         unset($data['client_logo']);
     }
     // update user
     parent::update($id, $data);
     if ($updateIdentity) {
         self::updateIdentity($data);
     }
 }
开发者ID:radypala,项目名称:maga-website,代码行数:53,代码来源:UsersModel.php

示例15: update

 /**
  * Saves changes to user record. You must make sure all required user fields are set before calling this method. If errors occur you can use the standard Table class error handling methods to figure out what went wrong.
  *
  * Required fields are user_name, password, fname and lname.
  *
  * If you do not call this method at the end of your request changed user vars will not be saved! If you are also using the Auth class, the Auth->close() method will call this for you.
  *
  * @access public
  * @return bool Returns true if no error, false if error occurred
  */
 public function update($pa_options = null)
 {
     $this->clearErrors();
     if ($this->changed('email')) {
         if (!caCheckEmailAddress($this->get('email'))) {
             $this->postError(922, _t("Invalid email address"), 'ca_users->update()');
             return false;
         }
     }
     if ($this->changed('password')) {
         try {
             $vs_backend_password = AuthenticationManager::updatePassword($this->get('user_name'), $this->get('password'));
             $this->set('password', $vs_backend_password);
             $this->removePendingPasswordReset(true);
         } catch (AuthClassFeatureException $e) {
             $this->postError(922, $e->getMessage(), 'ca_users->update()');
             return false;
             // maybe don't barf here?
         }
     }
     # set user vars (the set() method automatically serializes the vars array)
     if ($this->opa_user_vars_have_changed) {
         $this->set("vars", $this->opa_user_vars);
     }
     if ($this->opa_volatile_user_vars_have_changed) {
         $this->set("volatile_vars", $this->opa_volatile_user_vars);
     }
     unset(ca_users::$s_user_role_cache[$this->getPrimaryKey()]);
     unset(ca_users::$s_group_role_cache[$this->getPrimaryKey()]);
     return parent::update();
 }
开发者ID:kai-iak,项目名称:providence,代码行数:41,代码来源:ca_users.php


注:本文中的BaseModel::update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。