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