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


PHP DataObject::update方法代码示例

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


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

示例1: update

 /**
  * Overload the update() method so we can fall back on idcontact as an update key
  */
 function update()
 {
     if ($this->getPrimaryKeyValue()) {
         parent::update();
     } else {
         $this->query("UPDATE " . $this->getTable() . " SET `when`=now() WHERE idcontact=" . $this->idcontact);
     }
 }
开发者ID:jacquesbagui,项目名称:ofuz,代码行数:11,代码来源:Activity.class.php

示例2: checkForSubmit

 /**
  * Check for submit, therefore all fields must be set 
  */
 protected function checkForSubmit()
 {
     if (!$this->wasSubmitted) {
         return;
     }
     $this->validateAllFieldsets();
     $Failures = FormularField::getValidationFailures();
     if (empty($Failures)) {
         $this->dataObject->setFromArray($_POST);
         if ($this->submitMode == self::$SUBMIT_MODE_CREATE) {
             $this->dataObject->insert();
         } elseif ($this->submitMode == self::$SUBMIT_MODE_EDIT) {
             $this->dataObject->update();
         }
     }
     foreach ($Failures as $message) {
         $this->addFailure($message);
     }
     if (!$this->submitSucceeded() || $this->submitMode == self::$SUBMIT_MODE_EDIT) {
         $this->initFieldsets();
     }
 }
开发者ID:n0rthface,项目名称:Runalyze,代码行数:25,代码来源:class.StandardFormular.php

示例3: updateDataObject

 /**
  * Converts either the given HTTP Body into an array
  * (based on the DataFormatter instance), or returns
  * the POST variables.
  * Automatically filters out certain critical fields
  * that shouldn't be set by the client (e.g. ID).
  *
  * @param DataObject $obj
  * @param DataFormatter $formatter
  * @return DataObject The passed object
  */
 protected function updateDataObject($obj, $formatter)
 {
     // if neither an http body nor POST data is present, return error
     $body = $this->request->getBody();
     if (!$body && !$this->request->postVars()) {
         $this->getResponse()->setStatusCode(204);
         // No Content
         return 'No Content';
     }
     if (!empty($body)) {
         $data = $formatter->convertStringToArray($body);
     } else {
         // assume application/x-www-form-urlencoded which is automatically parsed by PHP
         $data = $this->request->postVars();
     }
     // @todo Disallow editing of certain keys in database
     $data = array_diff_key($data, array('ID', 'Created'));
     $apiAccess = singleton($this->urlParams['ClassName'])->stat('api_access');
     if (is_array($apiAccess) && isset($apiAccess['edit'])) {
         $data = array_intersect_key($data, array_combine($apiAccess['edit'], $apiAccess['edit']));
     }
     $obj->update($data);
     $obj->write();
     return $obj;
 }
开发者ID:hamishcampbell,项目名称:silverstripe-sapphire,代码行数:36,代码来源:RestfulServer.php

示例4: update_progress

 /**
  * Update this with the message, info and write to the database.
  * @param $message
  * @param null $info
  * @return ProgressLogEntry $this
  */
 protected function update_progress($message, $info = null)
 {
     parent::update(array('ResultMessage' => $message, 'ResultInfo' => $info));
     $this->write();
     return $this;
 }
开发者ID:helpfulrobot,项目名称:govtnz-progresslogentry,代码行数:12,代码来源:ProgressLogEntry.php

示例5: update

 /**
  * Overload the update() method to add last update date in UpdateRecordLog
  */
 function update()
 {
     parent::update();
     if ($this->getPrimaryKeyValue() > 0) {
         $rlog = new UpdateRecordLog();
         $rlog->setLastUpdate($this->getTable(), $this->getPrimaryKeyValue());
         // moved to eventUpdateWebView();
         //$q = new sqlQuery($GLOBALS['conx']);
         //$q->query("UPDATE ".$this->getSqlViewName()." SET last_update=now() WHERE idcontact=".$this->getPrimaryKeyValue());
         //$q->free();
         $this->setActivity();
     }
     $_SESSION['refresh_contacts'] = true;
 }
开发者ID:jacquesbagui,项目名称:ofuz,代码行数:17,代码来源:.Contact.class.php

示例6: writeLanguageObject

 /**
  * Writes the given language object
  *
  * @param DataObject $languageObj Language object to write
  * @param array      $mainRecord  Main record data of the multilingual DataObject
  *
  * @return void 
  * 
  * @author Roland Lehmann <rlehmann@pixeltricks.de>
  * @since 04.01.2012
  */
 public static function writeLanguageObject($languageObj, $mainRecord)
 {
     $record = array();
     foreach ($languageObj->db() as $dbFieldName => $dbFieldType) {
         if (array_key_exists($dbFieldName, $mainRecord)) {
             $record[$dbFieldName] = $mainRecord[$dbFieldName];
         }
     }
     $languageObj->update($record);
     $languageObj->write();
 }
开发者ID:silvercart,项目名称:silvercart,代码行数:22,代码来源:SilvercartLanguageHelper.php


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