当前位置: 首页>>代码示例>>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;未经允许,请勿转载。