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