本文整理汇总了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);
}
}
示例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();
}
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}