本文整理匯總了PHP中Transform::get_by_id方法的典型用法代碼示例。如果您正苦於以下問題:PHP Transform::get_by_id方法的具體用法?PHP Transform::get_by_id怎麽用?PHP Transform::get_by_id使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Transform
的用法示例。
在下文中一共展示了Transform::get_by_id方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: generateInflectedFormWithModel
public function generateInflectedFormWithModel($form, $inflId, $modelId)
{
if (!ConstraintMap::validInflection($inflId, $this->restriction)) {
return array();
}
$ifs = array();
$mds = Model::factory('ModelDescription')->where('modelId', $modelId)->where('inflectionId', $inflId)->order_by_asc('variant')->order_by_asc('applOrder')->find_many();
$start = 0;
while ($start < count($mds)) {
// Identify all the md's that differ only by the applOrder
$end = $start + 1;
while ($end < count($mds) && $mds[$end]->applOrder != 0) {
$end++;
}
$inflId = $mds[$start]->inflectionId;
$accentShift = $mds[$start]->accentShift;
$vowel = $mds[$start]->vowel;
// Apply all the transforms from $start to $end - 1.
$variant = $mds[$start]->variant;
$recommended = $mds[$start]->recommended;
// Load the transforms
$transforms = array();
for ($i = $end - 1; $i >= $start; $i--) {
$transforms[] = Transform::get_by_id($mds[$i]->transformId);
}
$result = FlexStringUtil::applyTransforms($form, $transforms, $accentShift, $vowel);
if (!$result) {
throw new Exception();
}
$ifs[] = InflectedForm::create($result, $this->id, $inflId, $variant, $recommended);
$start = $end;
}
return $ifs;
}