當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Translation::setTrnCategory方法代碼示例

本文整理匯總了PHP中Translation::setTrnCategory方法的典型用法代碼示例。如果您正苦於以下問題:PHP Translation::setTrnCategory方法的具體用法?PHP Translation::setTrnCategory怎麽用?PHP Translation::setTrnCategory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Translation的用法示例。


在下文中一共展示了Translation::setTrnCategory方法的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());
     }
 }
開發者ID:rodrigoivan,項目名稱:processmaker,代碼行數:23,代碼來源:Translation.php

示例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
 }
開發者ID:nshong,項目名稱:processmaker,代碼行數:33,代碼來源:Translation.php


注:本文中的Translation::setTrnCategory方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。