本文整理匯總了PHP中Translation::setTrnUpdateDate方法的典型用法代碼示例。如果您正苦於以下問題:PHP Translation::setTrnUpdateDate方法的具體用法?PHP Translation::setTrnUpdateDate怎麽用?PHP Translation::setTrnUpdateDate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Translation
的用法示例。
在下文中一共展示了Translation::setTrnUpdateDate方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: post
/**
* Implementation for 'POST' method for Rest API
*
* @param mixed $trnCategory, $trnId, $trnLang Primary key
*
* @return array $result Returns array within multiple records or a single record depending if
* a single selection was requested passing id(s) as param
*/
protected function post($trnCategory, $trnId, $trnLang, $trnValue, $trnUpdateDate)
{
try {
$result = array();
$obj = new Translation();
$obj->setTrnCategory($trnCategory);
$obj->setTrnId($trnId);
$obj->setTrnLang($trnLang);
$obj->setTrnValue($trnValue);
$obj->setTrnUpdateDate($trnUpdateDate);
$obj->save();
} catch (Exception $e) {
throw new RestException(412, $e->getMessage());
}
}
示例2: addTranslation
/**
* returns an array with
* codError 0 - no error, < 0 error
* rowsAffected 0,1 the number of rows affected
* message message error.
*/
function addTranslation($category, $id, $languageId, $value)
{
//if exists the row in the database propel will update it, otherwise will insert.
$tr = TranslationPeer::retrieveByPK($category, $id, $languageId);
if (!(is_object($tr) && get_class($tr) == 'Translation')) {
$tr = new Translation();
}
$tr->setTrnCategory($category);
$tr->setTrnId($id);
$tr->setTrnLang($languageId);
$tr->setTrnValue($value);
$tr->setTrnUpdateDate(date('Y-m-d'));
if ($tr->validate()) {
// we save it, since we get no validation errors, or do whatever else you like.
$res = $tr->save();
} else {
// Something went wrong. We can now get the validationFailures and handle them.
$msg = '';
$validationFailuresArray = $tr->getValidationFailures();
foreach ($validationFailuresArray as $objValidationFailure) {
$msg .= $objValidationFailure->getMessage() . "\n";
}
return array('codError' => -100, 'rowsAffected' => 0, 'message' => $msg);
}
return array('codError' => 0, 'rowsAffected' => $res, 'message' => '');
//to do: uniform coderror structures for all classes
}