本文整理匯總了PHP中Translation::newFromRow方法的典型用法代碼示例。如果您正苦於以下問題:PHP Translation::newFromRow方法的具體用法?PHP Translation::newFromRow怎麽用?PHP Translation::newFromRow使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Translation
的用法示例。
在下文中一共展示了Translation::newFromRow方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getAllTranslations
/**
* @return Translation[]
*/
public function getAllTranslations()
{
$dbr = Database::getConnection(DB_SLAVE);
$rows = $dbr->select(array('cx_translations', 'cx_translators'), '*', array('translator_translation_id = translation_id', 'translator_user_id' => $this->getGlobalUserId()), __METHOD__, array('ORDER BY' => 'translation_last_updated_timestamp DESC'));
$result = array();
foreach ($rows as $row) {
$result[] = Translation::newFromRow($row);
}
return $result;
}
示例2: getAllTranslations
/**
* @param int $limit How many results to return
* @param string [$offset] Offset condition (timestamp)
* @return Translation[]
*/
public function getAllTranslations($limit, $offset = null, $type = null)
{
// Note: there is no index on translation_last_updated_timestamp
$dbr = Database::getConnection(DB_SLAVE);
$tables = array('cx_translations', 'cx_translators');
$fields = '*';
$conds = array('translator_translation_id = translation_id', 'translator_user_id' => $this->getGlobalUserId());
if ($type !== null) {
$conds['translation_status'] = $type;
}
if ($offset !== null) {
$ts = $dbr->addQuotes($dbr->timestamp($offset));
$conds[] = "translation_last_updated_timestamp < {$ts}";
}
$options = array('ORDER BY' => 'translation_last_updated_timestamp DESC', 'LIMIT' => $limit);
$res = $dbr->select($tables, $fields, $conds, __METHOD__, $options);
$result = array();
foreach ($res as $row) {
$result[] = Translation::newFromRow($row);
}
return $result;
}
示例3: newFromId
public static function newFromId($translationId)
{
$dbr = Database::getConnection(DB_SLAVE);
$rows = $dbr->select(array('cx_translations', 'cx_drafts'), '*', array('translation_id' => $translationId, 'draft_id' => $translationId), __METHOD__);
$result = array();
foreach ($rows as $row) {
$result[] = Translation::newFromRow($row);
}
return $result;
}