if (!$hasInvariableModel) { $models[] = Model::factory('FlexModel')->where('modelType', 'I')->where('number', '1')->find_one(); } $modelTypes = array(); foreach ($models as $m) { $modelTypes[] = ModelType::get_by_code($m->modelType); } $lexems = Model::factory('Lexem')->table_alias('l')->select('l.*')->join('LexemModel', 'lm.lexemId = l.id', 'lm')->where('lm.modelType', 'T')->where_like('l.reverse', "{$reverseSuffix}%")->order_by_asc('l.formNoAccent')->limit(20)->find_many(); // $lmMatrix[$i][$j] = lexem model (with inflected forms) for lexem $i and model $j $lmMatrix = array(); foreach ($lexems as $l) { $lm = $l->getFirstLexemModel(); $lmArray = array(); foreach ($models as $m) { // Force a reload $lm = LexemModel::get_by_id($lm->id); $lm->modelType = $m->modelType; $lm->modelNumber = $m->number; $lm->generateInflectedFormMap(); $lmArray[] = $lm; } $lmMatrix[] = $lmArray; } // Load the definitions for each lexem $searchResults = array(); foreach ($lexems as $l) { $definitions = Definition::loadByLexemId($l->id); $searchResults[] = SearchResult::mapDefinitionArray($definitions); } SmartyWrap::assign('suffix', $suffix); SmartyWrap::assign('lexems', $lexems);
$newMd->copyFrom($md); $newMd->modelId = $cloneModel->id; $newMd->save(); } // Clone the participle model if ($modelType == 'V') { $pm = ParticipleModel::loadByVerbModel($modelNumber); $clonePm = Model::factory('ParticipleModel')->create(); $clonePm->verbModel = $newModelNumber; $clonePm->adjectiveModel = $pm->adjectiveModel; $clonePm->save(); } // Migrate the selected lexems. if ($chooseLexems && $lexemModelIds) { foreach ($lexemModelIds as $lexemModelId) { $lm = LexemModel::get_by_id($lexemModelId); $lm->modelNumber = $newModelNumber; $lm->save(); // It is not necessary to regenerate the paradigm for now, since // the inflected forms are identical. } } util_redirect('../admin/index.php'); exit; } } else { $newModelNumber = $modelNumber . ".1"; } $lexemModels = LexemModel::loadByCanonicalModel($modelType, $modelNumber); SmartyWrap::assign('modelType', $modelType); SmartyWrap::assign('modelNumber', $modelNumber);